ソースを参照

Show loading states within MenuItemWidget

ashilkn 2 年 前
コミット
b5202f4880

+ 0 - 8
lib/ui/actions/collection/collection_sharing_actions.dart

@@ -36,21 +36,13 @@ class CollectionActions {
     Collection collection, {
     Collection collection, {
     bool enableCollect = false,
     bool enableCollect = false,
   }) async {
   }) async {
-    final dialog = createProgressDialog(
-      context,
-      "Creating link...",
-      isDismissible: true,
-    );
     try {
     try {
-      await dialog.show();
       await CollectionsService.instance.createShareUrl(
       await CollectionsService.instance.createShareUrl(
         collection,
         collection,
         enableCollect: enableCollect,
         enableCollect: enableCollect,
       );
       );
-      dialog.hide();
       return true;
       return true;
     } catch (e) {
     } catch (e) {
-      dialog.hide();
       if (e is SharingNotPermittedForFreeAccountsError) {
       if (e is SharingNotPermittedForFreeAccountsError) {
         _showUnSupportedAlert(context);
         _showUnSupportedAlert(context);
       } else {
       } else {

+ 3 - 3
lib/ui/sharing/album_participants_page.dart

@@ -160,7 +160,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
                           trailingIconIsMuted: true,
                           trailingIconIsMuted: true,
                           onTap: () async {
                           onTap: () async {
                             if (isOwner) {
                             if (isOwner) {
-                              await _navigateToManageUser(currentUser);
+                              _navigateToManageUser(currentUser);
                             }
                             }
                           },
                           },
                           isTopBorderRadiusRemoved: listIndex > 0,
                           isTopBorderRadiusRemoved: listIndex > 0,
@@ -185,7 +185,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
                       menuItemColor: getEnteColorScheme(context).fillFaint,
                       menuItemColor: getEnteColorScheme(context).fillFaint,
                       pressedColor: getEnteColorScheme(context).fillFaint,
                       pressedColor: getEnteColorScheme(context).fillFaint,
                       onTap: () async {
                       onTap: () async {
-                        await _navigateToAddUser(false);
+                        _navigateToAddUser(false);
                       },
                       },
                       isTopBorderRadiusRemoved: collaborators.isNotEmpty,
                       isTopBorderRadiusRemoved: collaborators.isNotEmpty,
                       borderRadius: 8,
                       borderRadius: 8,
@@ -259,7 +259,7 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
                       menuItemColor: getEnteColorScheme(context).fillFaint,
                       menuItemColor: getEnteColorScheme(context).fillFaint,
                       pressedColor: getEnteColorScheme(context).fillFaint,
                       pressedColor: getEnteColorScheme(context).fillFaint,
                       onTap: () async {
                       onTap: () async {
-                        await _navigateToAddUser(true);
+                        _navigateToAddUser(true);
                       },
                       },
                       isTopBorderRadiusRemoved: viewers.isNotEmpty,
                       isTopBorderRadiusRemoved: viewers.isNotEmpty,
                       borderRadius: 8,
                       borderRadius: 8,

+ 1 - 2
lib/ui/sharing/manage_album_participant.dart

@@ -80,7 +80,6 @@ class _ManageIndividualParticipantState
                         widget.collection,
                         widget.collection,
                         widget.user.email,
                         widget.user.email,
                         role: CollectionParticipantRole.collaborator,
                         role: CollectionParticipantRole.collaborator,
-                        showProgress: true,
                       );
                       );
                       if ((result ?? false) && mounted) {
                       if ((result ?? false) && mounted) {
                         widget.user.role = CollectionParticipantRole
                         widget.user.role = CollectionParticipantRole
@@ -113,7 +112,6 @@ class _ManageIndividualParticipantState
                         widget.collection,
                         widget.collection,
                         widget.user.email,
                         widget.user.email,
                         role: CollectionParticipantRole.viewer,
                         role: CollectionParticipantRole.viewer,
-                        showProgress: true,
                       );
                       );
                       if ((result ?? false) && mounted) {
                       if ((result ?? false) && mounted) {
                         widget.user.role =
                         widget.user.role =
@@ -139,6 +137,7 @@ class _ManageIndividualParticipantState
               leadingIconColor: warning500,
               leadingIconColor: warning500,
               menuItemColor: getEnteColorScheme(context).fillFaint,
               menuItemColor: getEnteColorScheme(context).fillFaint,
               pressedColor: getEnteColorScheme(context).fillFaint,
               pressedColor: getEnteColorScheme(context).fillFaint,
+              surfaceExecutionStates: false,
               onTap: () async {
               onTap: () async {
                 final result = await collectionActions.removeParticipant(
                 final result = await collectionActions.removeParticipant(
                   context,
                   context,

+ 3 - 0
lib/ui/sharing/manage_links_widget.dart

@@ -113,6 +113,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
                     ),
                     ),
                     trailingIcon: Icons.chevron_right,
                     trailingIcon: Icons.chevron_right,
                     menuItemColor: enteColorScheme.fillFaint,
                     menuItemColor: enteColorScheme.fillFaint,
+                    surfaceExecutionStates: false,
                     onTap: () async {
                     onTap: () async {
                       await showPicker();
                       await showPicker();
                     },
                     },
@@ -140,6 +141,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
                     onTap: () async {
                     onTap: () async {
                       await _showDeviceLimitPicker();
                       await _showDeviceLimitPicker();
                     },
                     },
+                    surfaceExecutionStates: false,
                   ),
                   ),
                   DividerWidget(
                   DividerWidget(
                     dividerType: DividerType.menuNoIcon,
                     dividerType: DividerType.menuNoIcon,
@@ -225,6 +227,7 @@ class _ManageSharedLinkWidgetState extends State<ManageSharedLinkWidget> {
                     leadingIconColor: warning500,
                     leadingIconColor: warning500,
                     menuItemColor: getEnteColorScheme(context).fillFaint,
                     menuItemColor: getEnteColorScheme(context).fillFaint,
                     pressedColor: getEnteColorScheme(context).fillFaint,
                     pressedColor: getEnteColorScheme(context).fillFaint,
+                    surfaceExecutionStates: false,
                     onTap: () async {
                     onTap: () async {
                       final bool result = await sharingActions.disableUrl(
                       final bool result = await sharingActions.disableUrl(
                         context,
                         context,

+ 3 - 0
lib/ui/sharing/share_collection_page.dart

@@ -170,6 +170,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
               leadingIcon: Icons.copy,
               leadingIcon: Icons.copy,
               menuItemColor: getEnteColorScheme(context).fillFaint,
               menuItemColor: getEnteColorScheme(context).fillFaint,
               pressedColor: getEnteColorScheme(context).fillFaint,
               pressedColor: getEnteColorScheme(context).fillFaint,
+              showOnlyLoadingState: true,
               onTap: () async {
               onTap: () async {
                 await Clipboard.setData(ClipboardData(text: url));
                 await Clipboard.setData(ClipboardData(text: url));
                 showShortToast(context, "Link copied to clipboard");
                 showShortToast(context, "Link copied to clipboard");
@@ -239,6 +240,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
           menuItemColor: getEnteColorScheme(context).fillFaint,
           menuItemColor: getEnteColorScheme(context).fillFaint,
           pressedColor: getEnteColorScheme(context).fillFaint,
           pressedColor: getEnteColorScheme(context).fillFaint,
           isBottomBorderRadiusRemoved: true,
           isBottomBorderRadiusRemoved: true,
+          showOnlyLoadingState: true,
           onTap: () async {
           onTap: () async {
             final bool result =
             final bool result =
                 await collectionActions.enableUrl(context, widget.collection);
                 await collectionActions.enableUrl(context, widget.collection);
@@ -259,6 +261,7 @@ class _ShareCollectionPageState extends State<ShareCollectionPage> {
           leadingIcon: Icons.link,
           leadingIcon: Icons.link,
           menuItemColor: getEnteColorScheme(context).fillFaint,
           menuItemColor: getEnteColorScheme(context).fillFaint,
           pressedColor: getEnteColorScheme(context).fillFaint,
           pressedColor: getEnteColorScheme(context).fillFaint,
+          showOnlyLoadingState: true,
           onTap: () async {
           onTap: () async {
             final bool result = await collectionActions.enableUrl(
             final bool result = await collectionActions.enableUrl(
               context,
               context,

+ 1 - 0
lib/ui/tools/debug/app_storage_viewer.dart

@@ -164,6 +164,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
                             pressedColor:
                             pressedColor:
                                 getEnteColorScheme(context).fillFaintPressed,
                                 getEnteColorScheme(context).fillFaintPressed,
                             borderRadius: 8,
                             borderRadius: 8,
+                            alwaysShowSuccessState: true,
                             onTap: () async {
                             onTap: () async {
                               for (var pathItem in paths) {
                               for (var pathItem in paths) {
                                 if (pathItem.allowCacheClear) {
                                 if (pathItem.allowCacheClear) {

+ 1 - 0
lib/ui/viewer/gallery/device_folder_page.dart

@@ -238,6 +238,7 @@ class _ResetIgnoredFilesWidgetState extends State<ResetIgnoredFilesWidget> {
           borderRadius: 8.0,
           borderRadius: 8.0,
           menuItemColor: getEnteColorScheme(context).fillFaint,
           menuItemColor: getEnteColorScheme(context).fillFaint,
           leadingIcon: Icons.cloud_off_outlined,
           leadingIcon: Icons.cloud_off_outlined,
+          alwaysShowSuccessState: true,
           onTap: () async {
           onTap: () async {
             await _removeFilesFromIgnoredFiles(
             await _removeFilesFromIgnoredFiles(
               widget.filesInDeviceCollection,
               widget.filesInDeviceCollection,