2026-03-09 16:39:54 +08:00

42 lines
1.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/// 图转视频任务项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,
);
}
}