π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refactor albums management sheet for improved structure and component usage
AmanRajSinghMourya5fddb18c3ae3
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart b/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dartindex 3b95035a89..0180f49852 100644--- a/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart+++ b/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart@@ -1,6 +1,7 @@import "dart:async";import "package:collection/collection.dart";+import "package:ente_components/ente_components.dart";import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/material.dart";import "package:hugeicons/hugeicons.dart";@@ -9,9 +10,6 @@ import "package:photos/models/collection/collection.dart";import "package:photos/services/collections_service.dart";import "package:photos/services/hidden_service.dart";import "package:photos/services/local_authentication_service.dart";-import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/components/base_bottom_sheet.dart";-import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";import "package:photos/ui/tabs/shared/all_links_page.dart";import "package:photos/ui/viewer/gallery/archive_page.dart";import "package:photos/ui/viewer/gallery/hidden_page.dart";@@ -20,98 +18,108 @@ import "package:photos/ui/viewer/gallery/uncategorized_page.dart";Future<void> showAlbumsManageSheet(BuildContext context) {final strings = AppLocalizations.of(context);- final colorScheme = getEnteColorScheme(context);- return showBaseBottomSheet<void>(- backgroundColor: colorScheme.backgroundColour,- closeButtonBackgroundColor: colorScheme.fill,- context,- title: strings.manage,- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- _manageItem(- label: strings.trash,- icon: HugeIcons.strokeRoundedDelete01,- iconColor: const Color(0xFFE3505A),- onTap: () async {- final ok = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- strings.authToViewTrashedFiles,- );- if (!ok || !context.mounted) return;- Navigator.of(context).pop();- unawaited(routeToPage(context, TrashPage()));- },- ),- const SizedBox(height: 8),- _manageItem(- label: strings.archive,- icon: HugeIcons.strokeRoundedArchive03,- iconColor: const Color(0xFF08C225),- onTap: () async {- Navigator.of(context).pop();- unawaited(routeToPage(context, ArchivePage()));- },- ),- const SizedBox(height: 8),- _manageItem(- label: strings.hidden,- icon: HugeIcons.strokeRoundedViewOff,- iconColor: const Color.fromRGBO(255, 169, 57, 1),- onTap: () async {- final ok = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- strings.authToViewYourHiddenFiles,- );- if (!ok || !context.mounted) return;- Navigator.of(context).pop();- unawaited(routeToPage(context, const HiddenPage()));- },- ),- const SizedBox(height: 8),- _manageItem(- label: strings.uncategorized,- icon: HugeIcons.strokeRoundedHelpCircle,- iconColor: colorScheme.textMuted,- onTap: () async {- Collection? collection = CollectionsService.instance- .getActiveCollections()- .firstWhereOrNull(- (c) => c.type == CollectionType.uncategorized,+ return showBottomSheetComponent<void>(+ context: context,+ builder: (sheetContext) {+ final colors = sheetContext.componentColors;+ return BottomSheetComponent(+ title: strings.manage,+ content: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ _manageItem(+ label: strings.trash,+ icon: HugeIcons.strokeRoundedDelete01,+ iconColor: const Color(0xFFE3505A),+ onTap: () async {+ final ok = await LocalAuthenticationService.instance+ .requestLocalAuthentication(+ context,+ strings.authToViewTrashedFiles,+ );+ if (!ok || !context.mounted) return;+ if (sheetContext.mounted) {+ Navigator.of(sheetContext).pop();+ }+ unawaited(routeToPage(context, TrashPage()));+ },+ ),+ const SizedBox(height: 8),+ _manageItem(+ label: strings.archive,+ icon: HugeIcons.strokeRoundedArchive03,+ iconColor: colors.primary,+ onTap: () async {+ Navigator.of(sheetContext).pop();+ unawaited(routeToPage(context, ArchivePage()));+ },+ ),+ const SizedBox(height: 8),+ _manageItem(+ label: strings.hidden,+ icon: HugeIcons.strokeRoundedViewOff,+ iconColor: colors.accentOrange,+ onTap: () async {+ final ok = await LocalAuthenticationService.instance+ .requestLocalAuthentication(+ context,+ strings.authToViewYourHiddenFiles,+ );+ if (!ok || !context.mounted) return;+ if (sheetContext.mounted) {+ Navigator.of(sheetContext).pop();+ }+ unawaited(routeToPage(context, const HiddenPage()));+ },+ ),+ const SizedBox(height: 8),+ _manageItem(+ label: strings.uncategorized,+ icon: HugeIcons.strokeRoundedHelpCircle,+ iconColor: colors.textLight,+ onTap: () async {+ Collection? collection = CollectionsService.instance+ .getActiveCollections()+ .firstWhereOrNull(+ (c) => c.type == CollectionType.uncategorized,+ );+ collection ??= await CollectionsService.instance+ .getUncategorizedCollection();+ if (!context.mounted) return;+ if (sheetContext.mounted) {+ Navigator.of(sheetContext).pop();+ }+ unawaited(routeToPage(context, UnCategorizedPage(collection)));+ },+ ),+ const SizedBox(height: 8),+ _manageItem(+ label: strings.links,+ icon: HugeIcons.strokeRoundedLink02,+ iconColor: colors.blue,+ onTap: () async {+ final data = await CollectionsService.instance+ .getSharedCollectionsAndMemoryLinks();+ if (!context.mounted) return;+ if (sheetContext.mounted) {+ Navigator.of(sheetContext).pop();+ }+ unawaited(+ routeToPage(+ context,+ AllLinksPage(+ quickLinks: data.collections.quickLinks,+ memoryShares: data.memoryLinks,+ titleHeroTag: "manage_links",+ ),+ ),);- collection ??=- await CollectionsService.instance.getUncategorizedCollection();- if (!context.mounted) return;- Navigator.of(context).pop();- unawaited(routeToPage(context, UnCategorizedPage(collection)));- },+ },+ ),+ ],),- const SizedBox(height: 8),- _manageItem(- label: strings.links,- icon: HugeIcons.strokeRoundedLink02,- iconColor: const Color(0xFF4080DA),- onTap: () async {- final data = await CollectionsService.instance- .getSharedCollectionsAndMemoryLinks();- if (!context.mounted) return;- Navigator.of(context).pop();- unawaited(- routeToPage(- context,- AllLinksPage(- quickLinks: data.collections.quickLinks,- memoryShares: data.memoryLinks,- titleHeroTag: "manage_links",- ),- ),- );- },- ),- ],- ),+ );+ },);}@@ -121,18 +129,14 @@ Widget _manageItem({required Color iconColor,required Future<void> Function() onTap,}) {- return MenuItemWidgetNew(+ return MenuComponent(title: label,- padding: const EdgeInsets.all(12),- leadingIconSize: 34,- leadingIconWidget: SizedBox(- width: 34,- height: 34,- child: Center(- child: HugeIcon(icon: icon, size: 18, color: iconColor),- ),+ leading: HugeIcon(+ icon: icon,+ size: 18,+ color: iconColor,),- trailingIcon: Icons.chevron_right_rounded,+ trailing: const Icon(Icons.chevron_right_rounded),onTap: onTap,);}