42 lines
1.3 KiB
Dart
42 lines
1.3 KiB
Dart
/// 图转视频任务项(V2 字段映射)
|
||
class TaskItem {
|
||
const TaskItem({
|
||
required this.templateName,
|
||
required this.title,
|
||
this.previewImageUrl,
|
||
this.previewVideoUrl,
|
||
this.imageCount = 0,
|
||
this.taskType,
|
||
this.needopt = false,
|
||
});
|
||
|
||
final String templateName;
|
||
final String title;
|
||
final String? previewImageUrl;
|
||
final String? previewVideoUrl;
|
||
final int imageCount;
|
||
final String? taskType;
|
||
final bool needopt;
|
||
|
||
@override
|
||
String toString() =>
|
||
'TaskItem(templateName: $templateName, title: $title, previewImageUrl: $previewImageUrl, '
|
||
'previewVideoUrl: $previewVideoUrl, imageCount: $imageCount, taskType: $taskType, needopt: $needopt)';
|
||
|
||
factory TaskItem.fromJson(Map<String, dynamic> json) {
|
||
final extract = json['extract'] as Map<String, dynamic>?;
|
||
final preempt = json['preempt'] as Map<String, dynamic>?;
|
||
final imgUrl = extract?['digitize'] as String?;
|
||
final videoUrl = preempt?['digitize'] as String?;
|
||
return TaskItem(
|
||
templateName: json['congregation'] as String? ?? '',
|
||
title: json['glossary'] as String? ?? '',
|
||
previewImageUrl: imgUrl,
|
||
previewVideoUrl: videoUrl,
|
||
imageCount: json['simplify'] as int? ?? 0,
|
||
taskType: json['cipher'] as String?,
|
||
needopt: json['allowance'] as bool? ?? false,
|
||
);
|
||
}
|
||
}
|