Explorar o código

Update ordering of actions

Vishnu Mohandas hai 1 ano
pai
achega
de15d16bc0
Modificáronse 1 ficheiros con 29 adicións e 25 borrados
  1. 29 25
      lib/ui/viewer/actions/file_selection_actions_widget.dart

+ 29 - 25
lib/ui/viewer/actions/file_selection_actions_widget.dart

@@ -1,3 +1,5 @@
+import "dart:async";
+
 import 'package:fast_base58/fast_base58.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
@@ -219,17 +221,6 @@ class _FileSelectionActionsWidgetState
       );
     }
 
-    if (widget.type.showDeleteOption()) {
-      items.add(
-        SelectionActionButton(
-          icon: Icons.delete_outline,
-          labelText: S.of(context).delete,
-          onTap: anyOwnedFiles ? _onDeleteClick : null,
-          shouldShow: ownedAndPendingUploadFilesCount > 0,
-        ),
-      );
-    }
-
     if (widget.type.showFavoriteOption()) {
       items.add(
         SelectionActionButton(
@@ -250,6 +241,26 @@ class _FileSelectionActionsWidgetState
       );
     }
 
+    items.add(
+      SelectionActionButton(
+        icon: Icons.grid_view_outlined,
+        labelText: S.of(context).createCollage,
+        onTap: _onCreateCollageClicked,
+        shouldShow: showCollageOption,
+      ),
+    );
+
+    if (widget.type.showDeleteOption()) {
+      items.add(
+        SelectionActionButton(
+          icon: Icons.delete_outline,
+          labelText: S.of(context).delete,
+          onTap: anyOwnedFiles ? _onDeleteClick : null,
+          shouldShow: ownedAndPendingUploadFilesCount > 0,
+        ),
+      );
+    }
+
     if (widget.type.showHideOption()) {
       items.add(
         SelectionActionButton(
@@ -309,15 +320,6 @@ class _FileSelectionActionsWidgetState
       );
     }
 
-    items.add(
-      SelectionActionButton(
-        icon: Icons.grid_view_outlined,
-        labelText: S.of(context).createCollage,
-        onTap: _onCreateCollageClicked,
-        shouldShow: showCollageOption,
-      ),
-    );
-
     if (items.isNotEmpty) {
       final scrollController = ScrollController();
       // h4ck: https://github.com/flutter/flutter/issues/57920#issuecomment-893970066
@@ -500,9 +502,11 @@ class _FileSelectionActionsWidgetState
 
   Future<void> _onCreatedSharedLinkClicked() async {
     if (split.ownedByCurrentUser.isEmpty) {
-      showShortToast(
-        context,
-        S.of(context).canOnlyCreateLinkForFilesOwnedByYou,
+      unawaited(
+        showShortToast(
+          context,
+          S.of(context).canOnlyCreateLinkForFilesOwnedByYou,
+        ),
       );
       return;
     }
@@ -545,7 +549,7 @@ class _FileSelectionActionsWidgetState
         await _copyLink();
       }
       if (actionResult.action == ButtonAction.second) {
-        routeToPage(
+        await routeToPage(
           context,
           ManageSharedLinkWidget(collection: _cachedCollectionForSharedLink),
         );
@@ -566,7 +570,7 @@ class _FileSelectionActionsWidgetState
       final String url =
           "${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
       await Clipboard.setData(ClipboardData(text: url));
-      showShortToast(context, S.of(context).linkCopiedToClipboard);
+      unawaited(showShortToast(context, S.of(context).linkCopiedToClipboard));
     }
   }