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
+10 -5
View File
@@ -14,6 +14,7 @@ class VideoBatchUploadQueue {
required this.uploadTask,
required this.saveTask,
required this.onChanged,
this.assetType = VideoBatchUploadAssetType.video,
this.onCompleted,
this.maxAssets = VideoBatchUploadConfig.maxAssets,
this.maxConcurrent = VideoBatchUploadConfig.maxConcurrent,
@@ -23,6 +24,7 @@ class VideoBatchUploadQueue {
final VideoBatchUploadUploadTask uploadTask;
final VideoBatchUploadSaveTask saveTask;
final VoidCallback onChanged;
final VideoBatchUploadAssetType assetType;
final FutureOr<void> Function()? onCompleted;
final int maxAssets;
final int maxConcurrent;
@@ -60,7 +62,7 @@ class VideoBatchUploadQueue {
if (hasActiveUploads) {
isExpanded = true;
_notifyChanged();
ToastUtils.showToast(msg: '视频正在上传中');
ToastUtils.showToast(msg: '${assetType.label}正在上传中');
return;
}
@@ -70,9 +72,10 @@ class VideoBatchUploadQueue {
}
final List<VideoBatchUploadTask> pickedTasks =
await VideoBatchUploadPicker.pickVideos(
await VideoBatchUploadPicker.pickMedia(
context,
maxAssets: maxAssets,
assetType: assetType,
);
if (pickedTasks.isEmpty) {
return;
@@ -157,7 +160,7 @@ class VideoBatchUploadQueue {
return;
}
ToastUtils.showAlterDialog(
titleText: '视频还在上传',
titleText: '${assetType.label}还在上传',
contentText: '离开会中断本次上传,确定要离开吗?',
confirmText: '离开',
confirmCallback: () {
@@ -315,11 +318,13 @@ class VideoBatchUploadQueue {
await onCompleted?.call();
if (failedCount > 0) {
ToastUtils.showToast(
msg: '已上传 $_completedRemovedCount 个,失败 $failedCount');
msg:
'已上传 $_completedRemovedCount ${assetType.unit},失败 $failedCount ${assetType.unit}');
return;
}
final int completed = _completedRemovedCount;
ToastUtils.showToast(msg: '已上传 $completed 个视频');
ToastUtils.showToast(
msg: '已上传 $completed ${assetType.unit}${assetType.label}');
tasks.clear();
isExpanded = false;
_resetBatchProgress();