Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

add albums manage sheet

AmanRajSinghMouryaad5551358d3b
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.dart
new file mode 100644
index 0000000000..45f1a12c9a
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/tabs/albums/albums_manage_sheet.dart
@@ -0,0 +1,146 @@
+import "dart:async";
+
+import "package:collection/collection.dart";
+import "package:ente_pure_utils/ente_pure_utils.dart";
+import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
+import "package:photos/generated/l10n.dart";
+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";
+import "package:photos/ui/viewer/gallery/trash_page.dart";
+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,
+ context,
+ title: strings.manage,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ _manageItem(
+ label: strings.trash,
+ icon: HugeIcons.strokeRoundedDelete02,
+ iconColor: const Color(0xFFE3505A),
+ iconBgColor: const Color(0xFFFAEBEB),
+ 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.strokeRoundedArchive,
+ iconColor: const Color(0xFF08C225),
+ iconBgColor: const Color(0xFFE7F6E9),
+ onTap: () async {
+ Navigator.of(context).pop();
+ unawaited(routeToPage(context, ArchivePage()));
+ },
+ ),
+ const SizedBox(height: 8),
+ _manageItem(
+ label: strings.hidden,
+ icon: HugeIcons.strokeRoundedViewOffSlash,
+ iconColor: const Color(0xFFE19714),
+ iconBgColor: const Color(0xFFFAF4EB),
+ 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,
+ iconBgColor: colorScheme.fillFaint,
+ onTap: () async {
+ Collection? collection = CollectionsService.instance
+ .getActiveCollections()
+ .firstWhereOrNull(
+ (c) => c.type == CollectionType.uncategorized,
+ );
+ 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),
+ iconBgColor: const Color(0xFFE7EFFA),
+ 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",
+ ),
+ ),
+ );
+ },
+ ),
+ ],
+ ),
+ );
+}
+
+Widget _manageItem({
+ required String label,
+ required List<List<dynamic>> icon,
+ required Color iconColor,
+ required Color iconBgColor,
+ required Future<void> Function() onTap,
+}) {
+ return MenuItemWidgetNew(
+ title: label,
+ padding: const EdgeInsets.all(12),
+ leadingIconSize: 34,
+ leadingIconWidget: Container(
+ width: 34,
+ height: 34,
+ decoration: BoxDecoration(
+ color: iconBgColor,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ alignment: Alignment.center,
+ child: HugeIcon(icon: icon, size: 18, color: iconColor),
+ ),
+ trailingIcon: Icons.chevron_right_rounded,
+ onTap: onTap,
+ );
+}