fix(upload_image): 修改媒体上传文件

This commit is contained in:
2026-05-29 17:58:44 +08:00
parent aa89e03bee
commit 037f14b52f
6 changed files with 117 additions and 15 deletions
@@ -14,6 +14,49 @@ typedef VideoBatchUploadSaveTask = Future<bool> Function(
VideoBatchUploadTask task,
);
enum VideoBatchUploadAssetType {
image,
video,
}
extension VideoBatchUploadAssetTypeText on VideoBatchUploadAssetType {
String get label {
switch (this) {
case VideoBatchUploadAssetType.image:
return '图片';
case VideoBatchUploadAssetType.video:
return '视频';
}
}
String get unit {
switch (this) {
case VideoBatchUploadAssetType.image:
return '';
case VideoBatchUploadAssetType.video:
return '';
}
}
String get localLabel {
switch (this) {
case VideoBatchUploadAssetType.image:
return '本地图片';
case VideoBatchUploadAssetType.video:
return '本地视频';
}
}
String get defaultFileName {
switch (this) {
case VideoBatchUploadAssetType.image:
return 'image.jpg';
case VideoBatchUploadAssetType.video:
return 'video.mp4';
}
}
}
enum VideoBatchUploadStatus {
waiting,
uploading,
@@ -45,6 +88,7 @@ extension VideoBatchUploadStatusText on VideoBatchUploadStatus {
class VideoBatchUploadTask {
VideoBatchUploadTask({
required this.id,
this.assetType = VideoBatchUploadAssetType.video,
required this.file,
required this.fileName,
required this.fileSize,
@@ -53,6 +97,7 @@ class VideoBatchUploadTask {
});
final String id;
final VideoBatchUploadAssetType assetType;
final File file;
final String fileName;
final int fileSize;
@@ -120,4 +165,8 @@ class VideoBatchUploadTask {
Map<String, dynamic> toLibraryVideoPayload() {
return toVideoPayload();
}
String toLibraryImageURL() {
return uploadUrl;
}
}