diff --git a/lib/providers/attachment_uploader.dart b/lib/providers/attachment_uploader.dart index 86d7f0e..7182a83 100644 --- a/lib/providers/attachment_uploader.dart +++ b/lib/providers/attachment_uploader.dart @@ -14,7 +14,7 @@ class AttachmentUploadTask { Map? metadata; Map? chunkFiles; - double progress = 0; + double? progress; bool isUploading = false; bool isCompleted = false; dynamic error; @@ -76,6 +76,7 @@ class AttachmentUploaderController extends GetxController { _startProgressSyncTimer(); queueOfUpload[queueIndex].isUploading = true; + queueOfUpload[queueIndex].progress = 0; final task = queueOfUpload[queueIndex]; try { @@ -121,6 +122,7 @@ class AttachmentUploaderController extends GetxController { } queueOfUpload[idx].isUploading = true; + queueOfUpload[idx].progress = 0; final task = queueOfUpload[idx]; try { diff --git a/lib/translations/en_us.dart b/lib/translations/en_us.dart index a91e332..7e3c35f 100644 --- a/lib/translations/en_us.dart +++ b/lib/translations/en_us.dart @@ -174,7 +174,7 @@ const i18nEnglish = { 'attachmentAttached': 'Exists Files', 'attachmentUploadBlocked': 'Upload blocked, there is currently a task in progress...', - 'attachmentAdd': 'Attach attachments', + 'attachmentAdd': 'Attach file', 'attachmentAddGalleryPhoto': 'Gallery photo', 'attachmentAddGalleryVideo': 'Gallery video', 'attachmentAddCameraPhoto': 'Capture photo', diff --git a/lib/widgets/attachments/attachment_editor.dart b/lib/widgets/attachments/attachment_editor.dart index 15f859e..12222ed 100644 --- a/lib/widgets/attachments/attachment_editor.dart +++ b/lib/widgets/attachments/attachment_editor.dart @@ -64,7 +64,7 @@ class _AttachmentEditorPopupState extends State { final AuthProvider auth = Get.find(); if (auth.isAuthorized.isFalse) return; - if (widget.singleMode) { + if (!widget.singleMode) { final medias = await _imagePicker.pickMultiImage( maxWidth: widget.imageMaxWidth, maxHeight: widget.imageMaxHeight, @@ -341,9 +341,25 @@ class _AttachmentEditorPopupState extends State { fontFamily: 'monospace', ), ), - Text( - 'In queue #${index + 1}', - style: const TextStyle(fontSize: 12), + Row( + children: [ + FutureBuilder( + future: element.file.length(), + builder: (context, snapshot) { + if (!snapshot.hasData) return const SizedBox(); + return Text( + _formatBytes(snapshot.data!), + style: Theme.of(context).textTheme.bodySmall, + ); + }, + ), + const SizedBox(width: 6), + if (element.progress != null) + Text( + '${(element.progress! * 100).toStringAsFixed(2)}%', + style: Theme.of(context).textTheme.bodySmall, + ), + ], ), ], ), @@ -590,15 +606,13 @@ class _AttachmentEditorPopupState extends State { children: [ Expanded( child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( - child: Text( - 'attachmentAdd'.tr, - style: - Theme.of(context).textTheme.headlineSmall, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), + Text( + 'attachmentAdd'.tr, + style: Theme.of(context).textTheme.headlineSmall, + maxLines: 1, + overflow: TextOverflow.ellipsis, ), const SizedBox(width: 10), Obx(() {