π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Refine albums tab interactions (#10610)
Aman Raj53c6cdf59cb9
diff --git a/mobile/apps/photos/assets/2.0x/collection_pin.png b/mobile/apps/photos/assets/2.0x/collection_pin.pngnew file mode 100644index 0000000000..973f6862cdBinary files /dev/null and b/mobile/apps/photos/assets/2.0x/collection_pin.png differdiff --git a/mobile/apps/photos/assets/3.0x/collection_pin.png b/mobile/apps/photos/assets/3.0x/collection_pin.pngnew file mode 100644index 0000000000..41ba7faea2Binary files /dev/null and b/mobile/apps/photos/assets/3.0x/collection_pin.png differdiff --git a/mobile/apps/photos/assets/collection_pin.png b/mobile/apps/photos/assets/collection_pin.pngnew file mode 100644index 0000000000..f3e497406dBinary files /dev/null and b/mobile/apps/photos/assets/collection_pin.png differdiff --git a/mobile/apps/photos/ios/Podfile.lock b/mobile/apps/photos/ios/Podfile.lockindex 263cb15984..4de8be119b 100644--- a/mobile/apps/photos/ios/Podfile.lock+++ b/mobile/apps/photos/ios/Podfile.lock@@ -488,9 +488,9 @@ SPEC CHECKSUMS:connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dddart_ui_isolate: 46f6714abe6891313267153ef6f9748d8ecfcab1device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe- ente_photos_rust: 79732f3ba67df7b0fb22089627afb80d692c2b2d+ ente_photos_rust: a9e1166cc460dda69acd56fbed21afe87dfef562ente_qr: d1a6c708e9b2f8166fd20963562a89b122110d25- ente_rust: 9c976e3d083f0ce90f31693deb99629b28d8fe4c+ ente_rust: d0197ebd5460e8f67576579452b073d698404abeffmpeg_kit_custom: 682b4f2f1ff1f8abae5a92f6c3540f2441d5be99ffmpeg_kit_flutter: 915b345acc97d4142e8a9a8549d177ff10f043f5file_saver: 6cdbcddd690cb02b0c1a0c225b37cd805c2bf8b6diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arbindex 9e5f84ffc0..516c9fb49b 100644--- a/mobile/apps/photos/lib/l10n/intl_en.arb+++ b/mobile/apps/photos/lib/l10n/intl_en.arb@@ -1859,6 +1859,7 @@},"enable": "Enable","enabled": "Enabled",+ "more": "More","moreDetails": "More details","enableMLIndexingDesc": "Ente supports on-device machine learning for face recognition, magic search and other advanced search features","magicSearchHint": "Magic search allows to search photos by their contents, e.g. 'flower', 'red car', 'identity documents'",diff --git a/mobile/apps/photos/lib/ui/collections/album/list_item.dart b/mobile/apps/photos/lib/ui/collections/album/list_item.dartindex f3ad6320af..d96b4d6013 100644--- a/mobile/apps/photos/lib/ui/collections/album/list_item.dart+++ b/mobile/apps/photos/lib/ui/collections/album/list_item.dart@@ -58,6 +58,7 @@ class AlbumListItemWidget extends StatelessWidget {final bool isOutgoing = isOwner && collection.hasSharees;final bool isIncoming = !isOwner;final bool showSharingIndicator = isOutgoing || isIncoming;+ final bool showLinkIndicator = isOwner && collection.hasLink;final bool isFavoriteAlbum = collection.type == CollectionType.favorites;final bool showPin = isOwner? collection.isPinned@@ -75,17 +76,12 @@ class AlbumListItemWidget extends StatelessWidget {onLongPress: onLongPressCallback == null? null: () => onLongPressCallback!(collection),- leading: _AlbumListItemCover(- collection: collection,+ leading: _AlbumListItemCover(collection: collection),+ title: _buildTitle(+ context,showSharingIndicator: showSharingIndicator,isOutgoing: isOutgoing,- ),- title: Text(- collection.displayName,- style: TextStyles.body.copyWith(color: colors.textBase),- maxLines: 1,- softWrap: false,- overflow: TextOverflow.ellipsis,+ showLinkIndicator: showLinkIndicator,),subtitle: FutureBuilder<int>(future: CollectionsService.instance.getFileCount(collection),@@ -149,6 +145,43 @@ class AlbumListItemWidget extends StatelessWidget {);}+ Widget _buildTitle(+ BuildContext context, {+ required bool showSharingIndicator,+ required bool isOutgoing,+ required bool showLinkIndicator,+ }) {+ final colors = context.componentColors;++ return Row(+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ Flexible(+ child: Text(+ collection.displayName,+ style: TextStyles.body.copyWith(color: colors.textBase),+ maxLines: 1,+ softWrap: false,+ overflow: TextOverflow.ellipsis,+ ),+ ),+ if (showSharingIndicator) ...[+ const SizedBox(width: 6),+ CollectionShareBadge(+ isOutgoing: isOutgoing,+ variant: CollectionShareBadgeVariant.outlined,+ ),+ ],+ if (showLinkIndicator) ...[+ const SizedBox(width: 4),+ const CollectionLinkBadge(+ variant: CollectionShareBadgeVariant.outlined,+ ),+ ],+ ],+ );+ }+Widget _buildSubtitle(BuildContext context, {required String text,@@ -175,11 +208,10 @@ class AlbumListItemWidget extends StatelessWidget {if (hasStatus) ...[Text(" \u2022 ", style: textStyle),if (showPin)- HugeIcon(- icon: HugeIcons.strokeRoundedPin,+ ImageIcon(+ const AssetImage("assets/collection_pin.png"),size: 12,color: colors.textLight,- strokeWidth: 2.0,),if (showArchive)HugeIcon(@@ -240,14 +272,8 @@ class AlbumListItemWidget extends StatelessWidget {class _AlbumListItemCover extends StatelessWidget {final Collection collection;- final bool showSharingIndicator;- final bool isOutgoing;- const _AlbumListItemCover({- required this.collection,- required this.showSharingIndicator,- required this.isOutgoing,- });+ const _AlbumListItemCover({required this.collection});@overrideWidget build(BuildContext context) {@@ -261,12 +287,20 @@ class _AlbumListItemCover extends StatelessWidget {child: SizedBox.expand(child: FutureBuilder<EnteFile?>(future: CollectionsService.instance.getCover(collection),+ initialData: CollectionsService.instance.getCoverCache(+ collection,+ ),builder: (context, snapshot) {- if (snapshot.hasData) {+ final thumbnail =+ snapshot.data ??+ CollectionsService.instance.getCoverCache(collection);+ if (thumbnail != null) {return ThumbnailWidget(- snapshot.data!,+ thumbnail,shouldShowFavoriteIcon: false,shouldShowOwnerAvatar: false,+ shouldShowSyncStatus: false,+ key: Key("album_list:${collection.id}:${thumbnail.tag}"),);}return const NoThumbnailWidget(@@ -277,12 +311,6 @@ class _AlbumListItemCover extends StatelessWidget {),),),- if (showSharingIndicator)- Positioned(- right: -4,- bottom: -4,- child: CollectionShareBadge(isOutgoing: isOutgoing),- ),],);}diff --git a/mobile/apps/photos/lib/ui/collections/album/new_row_item.dart b/mobile/apps/photos/lib/ui/collections/album/new_row_item.dartindex 6fd6c0d4c6..0b99b775c1 100644--- a/mobile/apps/photos/lib/ui/collections/album/new_row_item.dart+++ b/mobile/apps/photos/lib/ui/collections/album/new_row_item.dart@@ -1,13 +1,8 @@+import "dart:async";+import "package:ente_components/ente_components.dart";-import "package:ente_pure_utils/ente_pure_utils.dart";import 'package:flutter/material.dart';-import "package:logging/logging.dart";import "package:photos/generated/l10n.dart";-import 'package:photos/models/collection/collection.dart';-import 'package:photos/models/collection/collection_items.dart';-import "package:photos/services/collections_service.dart";-import "package:photos/ui/viewer/gallery/collection_page.dart";-import "package:photos/utils/dialog_util.dart";class NewAlbumRowItemWidget extends StatelessWidget {static const _cornerRadius = 20.0;@@ -15,58 +10,20 @@ class NewAlbumRowItemWidget extends StatelessWidget {final double height;final double width;+ final Future<void> Function(BuildContext context)? onTap;const NewAlbumRowItemWidget({super.key,required this.height,required this.width,+ this.onTap,});@overrideWidget build(BuildContext context) {final colors = context.componentColors;return GestureDetector(- onTap: () async {- final result = await showTextInputDialog(- context,- title: AppLocalizations.of(context).newAlbum,- submitButtonLabel: AppLocalizations.of(context).create,- hintText: AppLocalizations.of(context).enterAlbumName,- alwaysShowSuccessState: false,- initialValue: "",- textCapitalization: TextCapitalization.words,- popnavAfterSubmission: true,- onSubmit: (String text) async {- text = text.trim();- if (text == "") {- return;- }-- try {- final Collection c = await CollectionsService.instance- .createAlbum(text);-- // Close the dialog now so that it does not flash when leaving the album again.- Navigator.of(context).pop();-- // ignore: unawaited_futures- await routeToPage(- context,- CollectionPage(CollectionWithThumbnail(c, null)),- );- } catch (e, s) {- Logger(- "CreateNewAlbumRowItemWidget",- ).severe("Failed to rename album", e, s);- rethrow;- }- },- );-- if (result is Exception) {- await showGenericErrorDialog(context: context, error: result);- }- },+ onTap: onTap == null ? null : () => unawaited(onTap!(context)),child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [diff --git a/mobile/apps/photos/lib/ui/collections/album/row_item.dart b/mobile/apps/photos/lib/ui/collections/album/row_item.dartindex c2aa6c3a80..696fa059e4 100644--- a/mobile/apps/photos/lib/ui/collections/album/row_item.dart+++ b/mobile/apps/photos/lib/ui/collections/album/row_item.dart@@ -36,7 +36,7 @@ class AlbumRowItemWidget extends StatelessWidget {static const _thumbnailToTextSpacing = 8.0;static const _titleToSubtitleSpacing = 2.0;static const _sharePillPadding = EdgeInsets.all(2);- static const _sharedAvatarStrokeWidth = 2.0;+ static const _sharedAvatarStrokeWidth = 1.0;const AlbumRowItemWidget(this.c,@@ -59,13 +59,14 @@ class AlbumRowItemWidget extends StatelessWidget {"_" +c.id.toString();final componentColors = context.componentColors;+ final bool shouldShowSharePill = isOwner && (c.hasSharees || c.hasLink);final Widget? linkIcon = c.hasLink && isOwner? HugeIcon(icon: HugeIcons.strokeRoundedLink02,color: c.publicURLs.first.isExpired? componentColors.warning- : textBaseLight,- size: 10,+ : componentColors.specialWhite,+ size: 8,strokeWidth: 2,): null;@@ -120,6 +121,8 @@ class AlbumRowItemWidget extends StatelessWidget {fit: StackFit.expand,children: [thumbnailWidget,+ if (shouldShowSharePill)+ const _ThumbnailShareGradientOverlay(),if (isSelected)Container(decoration: BoxDecoration(@@ -141,7 +144,7 @@ class AlbumRowItemWidget extends StatelessWidget {}},),- if (isOwner && (c.hasSharees || c.hasLink))+ if (shouldShowSharePill)Positioned(top: _overlayPadding,left: _overlayPadding,@@ -150,10 +153,7 @@ class AlbumRowItemWidget extends StatelessWidget {transitionOnUserGestures: true,child: Container(padding: _sharePillPadding,- decoration: BoxDecoration(- color: fillLightLight,- borderRadius: BorderRadius.circular(40),- ),+ decoration: _sharePillDecoration(context),child: SizedBox(height: getAvatarSize(AvatarType.xs),child: _AlbumRowSharePillContent(@@ -340,6 +340,33 @@ class AlbumRowItemWidget extends StatelessWidget {);}+ BoxDecoration _sharePillDecoration(BuildContext context) {+ final isDarkMode = Theme.of(context).brightness == Brightness.dark;+ return BoxDecoration(+ borderRadius: BorderRadius.circular(40),+ gradient: RadialGradient(+ center: Alignment.center,+ radius: isDarkMode ? 1.28 : 1.18,+ colors: isDarkMode+ ? const [+ Color.fromRGBO(46, 46, 46, 1),+ Color.fromRGBO(50, 50, 50, 0),+ ]+ : const [+ Color.fromRGBO(255, 255, 255, 0.51),+ Color.fromRGBO(255, 255, 255, 0.1275),+ ],+ ),+ boxShadow: [+ BoxShadow(+ color: Color.fromRGBO(0, 0, 0, isDarkMode ? 0.15 : 0.05),+ offset: const Offset(0, 1),+ blurRadius: isDarkMode ? 1.5 : 0.8,+ ),+ ],+ );+ }+Widget _buildAlbumStatusChips({required bool isOwner}) {final bool isFavoriteAlbum = c.type == CollectionType.favorites;final bool showPin = isOwner ? c.isPinned : c.hasShareePinned();@@ -365,6 +392,32 @@ class AlbumRowItemWidget extends StatelessWidget {}}+class _ThumbnailShareGradientOverlay extends StatelessWidget {+ const _ThumbnailShareGradientOverlay();++ @override+ Widget build(BuildContext context) {+ return IgnorePointer(+ child: DecoratedBox(+ decoration: BoxDecoration(+ gradient: LinearGradient(+ begin: Alignment.bottomLeft,+ end: Alignment.topRight,+ transform: const GradientRotation(pi / 4),+ colors: [+ Colors.black.withValues(alpha: 0.16),+ Colors.black.withValues(alpha: 0.06),+ Colors.transparent,+ ],+ stops: const [0, 0.42, 0.78],+ ),+ ),+ child: const SizedBox.expand(),+ ),+ );+ }+}+class _AlbumRowSharePillContent extends StatelessWidget {static const _limitCountTo = 2;@@ -380,8 +433,12 @@ class _AlbumRowSharePillContent extends StatelessWidget {const type = AvatarType.xs;final double avatarSize = getAvatarSize(type);final double overlapPadding = getOverlapPadding(type);- final trailingWidgetWidth = trailingWidget == null ? 0.0 : avatarSize;final visibleAvatarCount = displayCount + (hasMore ? 1 : 0);+ final trailingWidgetWidth = trailingWidget == null+ ? 0.0+ : visibleAvatarCount == 0+ ? avatarSize+ : 14.0;final visibleAvatarsWidth = visibleAvatarCount == 0? 0.0: avatarSize + (visibleAvatarCount - 1) * overlapPadding;@@ -416,9 +473,12 @@ class _AlbumRowSharePillContent extends StatelessWidget {widgets.add(Positioned(left: visibleAvatarsWidth,+ top: (avatarSize - trailingWidgetWidth) / 2,child: SizedBox.square(- dimension: avatarSize,- child: Center(child: trailingWidget!),+ dimension: trailingWidgetWidth,+ child: Center(+ child: SizedBox.square(dimension: 8, child: trailingWidget!),+ ),),),);diff --git a/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart b/mobile/apps/photos/lib/ui/collections/flex_grid_view.dartindex 2f5896f3b4..d877900874 100644--- a/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart+++ b/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart@@ -126,41 +126,20 @@ class _CollectionsFlexiGridViewWidgetState}Future<void> _createAlbum() async {- final result = await showTextInputDialog(- context,- title: AppLocalizations.of(context).newAlbum,- submitButtonLabel: AppLocalizations.of(context).create,- hintText: AppLocalizations.of(context).enterAlbumName,- alwaysShowSuccessState: false,- initialValue: "",- textCapitalization: TextCapitalization.words,- popnavAfterSubmission: false,- onSubmit: (String text) async {- text = text.trim();- if (text == "") {- return;- }-- try {- final Collection c = await CollectionsService.instance.createAlbum(- text,- );- // ignore: unawaited_futures- await routeToPage(- context,- CollectionPage(CollectionWithThumbnail(c, null)),- );- Navigator.of(context).pop();- } catch (e, s) {- Logger(- "CollectionsFlexiGridViewWidget",- ).severe("Failed to create album", e, s);- rethrow;- }- },+ final result = await showBottomSheetComponent<Object?>(+ context: context,+ builder: (_) => const _CreateAlbumBottomSheet(),);- if (result is Exception) {+ if (!mounted || result == null) {+ return;+ }+ if (result is Collection) {+ await routeToPage(+ context,+ CollectionPage(CollectionWithThumbnail(result, null)),+ );+ } else {await showGenericErrorDialog(context: context, error: result);}}@@ -220,6 +199,7 @@ class _CollectionsFlexiGridViewWidgetStatereturn NewAlbumRowItemWidget(height: sideOfThumbnail,width: sideOfThumbnail,+ onTap: (_) => _createAlbum(),);}final collectionIndex = showCreateAlbum ? index - 1 : index;@@ -290,14 +270,18 @@ class _CollectionsFlexiGridViewWidgetStatesliver: SliverList.builder(itemBuilder: (context, index) {Widget item;+ Key itemKey;if (showCreateAlbum && index == 0) {+ itemKey = ValueKey("${widget.tag}_new_album_list_item");item = NewAlbumListItemWidget(onTap: (_) => _createAlbum());} else {final collectionIndex = showCreateAlbum ? index - 1 : index;+ final collection = widget.collections![collectionIndex];+ itemKey = ValueKey("${widget.tag}_list_${collection.id}");item = AlbumListItemWidget(- widget.collections![collectionIndex],+ collection,selectedAlbums: widget.selectedAlbums,onTapCallback: (c) {isAnyAlbumSelected@@ -315,6 +299,7 @@ class _CollectionsFlexiGridViewWidgetState}return Padding(+ key: itemKey,padding: const EdgeInsets.symmetric(vertical: ThumbnailListItem.defaultItemSpacing / 2,),@@ -326,3 +311,78 @@ class _CollectionsFlexiGridViewWidgetState);}}++class _CreateAlbumBottomSheet extends StatefulWidget {+ const _CreateAlbumBottomSheet();++ @override+ State<_CreateAlbumBottomSheet> createState() =>+ _CreateAlbumBottomSheetState();+}++class _CreateAlbumBottomSheetState extends State<_CreateAlbumBottomSheet> {+ final _controller = TextEditingController();+ bool _hasAlbumName = false;++ @override+ void dispose() {+ _controller.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final strings = AppLocalizations.of(context);+ return BottomSheetComponent(+ title: strings.newAlbum,+ isKeyboardAware: true,+ content: TextInputComponent(+ controller: _controller,+ hintText: strings.enterAlbumName,+ autofocus: true,+ isClearable: true,+ textCapitalization: TextCapitalization.words,+ onSubmit: (_) => _createAlbum(),+ onChanged: (_) {+ final hasAlbumName = _controller.text.trim().isNotEmpty;+ if (_hasAlbumName == hasAlbumName) {+ return;+ }+ setState(() {+ _hasAlbumName = hasAlbumName;+ });+ },+ ),+ actions: [+ ButtonComponent(+ label: strings.create,+ isDisabled: !_hasAlbumName,+ onTap: _createAlbum,+ ),+ ],+ );+ }++ Future<void> _createAlbum() async {+ final albumName = _controller.text.trim();+ if (albumName.isEmpty) {+ return;+ }++ try {+ final collection = await CollectionsService.instance.createAlbum(+ albumName,+ );+ if (!mounted) {+ return;+ }+ Navigator.of(context).pop(collection);+ } catch (e, s) {+ Logger("CreateAlbumBottomSheet").severe("Failed to create album", e, s);+ if (!mounted) {+ return;+ }+ Navigator.of(context).pop(e);+ }+ }+}diff --git a/mobile/apps/photos/lib/ui/components/collection_share_badge.dart b/mobile/apps/photos/lib/ui/components/collection_share_badge.dartindex 2cd66f13c3..eb0805f31a 100644--- a/mobile/apps/photos/lib/ui/components/collection_share_badge.dart+++ b/mobile/apps/photos/lib/ui/components/collection_share_badge.dart@@ -10,8 +10,6 @@ const double kCollectionBadgeStrokeWidth = 2.0;const double kCollectionBadgeBorderWidth = 1.0;class CollectionStatusBadge extends StatelessWidget {- static const Color backgroundColor = Color.fromRGBO(0, 0, 0, 0.24);-final Widget child;const CollectionStatusBadge({super.key, required this.child});@@ -21,10 +19,7 @@ class CollectionStatusBadge extends StatelessWidget {return Container(width: kCollectionBadgeSize,height: kCollectionBadgeSize,- decoration: const BoxDecoration(- color: backgroundColor,- shape: BoxShape.circle,- ),+ decoration: const BoxDecoration(shape: BoxShape.circle),child: Center(child: child),);}@@ -68,11 +63,10 @@ class CollectionPinnedBadge extends StatelessWidget {@overrideWidget build(BuildContext context) {return const CollectionStatusBadge(- child: HugeIcon(- icon: HugeIcons.strokeRoundedPin,+ child: ImageIcon(+ AssetImage("assets/collection_pin.png"),size: kCollectionBadgeIconSize,color: Colors.white,- strokeWidth: kCollectionBadgeStrokeWidth,),);}@@ -94,23 +88,31 @@ class CollectionArchivedBadge extends StatelessWidget {}}+enum CollectionShareBadgeVariant { filled, outlined }+class CollectionShareBadge extends StatelessWidget {final bool isOutgoing;+ final CollectionShareBadgeVariant variant;- const CollectionShareBadge({super.key, required this.isOutgoing});+ const CollectionShareBadge({+ super.key,+ required this.isOutgoing,+ this.variant = CollectionShareBadgeVariant.filled,+ });@overrideWidget build(BuildContext context) {final colorScheme = getEnteColorScheme(context);+ final isOutlined = variant == CollectionShareBadgeVariant.outlined;return Container(- width: kCollectionBadgeSize,- height: kCollectionBadgeSize,+ width: 12,+ height: 12,decoration: BoxDecoration(- color: colorScheme.greenBase,+ color: isOutlined ? Colors.transparent : colorScheme.greenBase,shape: BoxShape.circle,border: Border.all(- color: colorScheme.fill,- width: kCollectionBadgeBorderWidth,+ color: isOutlined ? colorScheme.greenBase : colorScheme.fill,+ width: isOutlined ? 1.0 : kCollectionBadgeBorderWidth,),),child: Center(@@ -119,8 +121,8 @@ class CollectionShareBadge extends StatelessWidget {? HugeIcons.strokeRoundedArrowUpRight01: HugeIcons.strokeRoundedArrowDownLeft01,strokeWidth: kCollectionBadgeStrokeWidth,- color: Colors.white,- size: kCollectionBadgeIconSize,+ color: isOutlined ? colorScheme.greenBase : Colors.white,+ size: 8,),),);@@ -128,11 +130,26 @@ class CollectionShareBadge extends StatelessWidget {}class CollectionLinkBadge extends StatelessWidget {- const CollectionLinkBadge({super.key});+ final CollectionShareBadgeVariant variant;++ const CollectionLinkBadge({+ super.key,+ this.variant = CollectionShareBadgeVariant.filled,+ });@overrideWidget build(BuildContext context) {final colorScheme = getEnteColorScheme(context);+ final isOutlined = variant == CollectionShareBadgeVariant.outlined;+ if (isOutlined) {+ return HugeIcon(+ icon: HugeIcons.strokeRoundedLink02,+ strokeWidth: kCollectionBadgeStrokeWidth,+ color: colorScheme.greenBase,+ size: kCollectionBadgeIconSize,+ );+ }+return Container(width: kCollectionBadgeSize,height: kCollectionBadgeSize,diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dartindex 91e08c2bae..16dfc8965d 100644--- a/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart@@ -2,6 +2,7 @@ import 'dart:math';import 'package:ente_components/ente_components.dart';import 'package:ente_pure_utils/ente_pure_utils.dart';+import 'package:figma_squircle/figma_squircle.dart';import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:intl/intl.dart';@@ -51,7 +52,10 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {static const _gridHorizontalPadding = 16.0;static const _gridCrossSpacing = 8.0;static const _gridMainSpacing = 8.0;- static const _thumbnailRadius = 12.0;+ static const _cornerRadius = 20.0;+ static const _cornerSmoothing = 0.6;+ static const _thumbnailToTextSpacing = 8.0;+ static const _titleToSubtitleSpacing = 4.0;@overridevoid initState() {@@ -285,6 +289,7 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {final sideOfThumbnail =(screenWidth - totalCrossAxisSpacing - _gridHorizontalPadding) /crossAxisCount;+ final gridItemTextHeight = _gridItemTextHeight(context);return SliverPadding(padding: const EdgeInsets.symmetric(@@ -298,23 +303,39 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {crossAxisCount: crossAxisCount,crossAxisSpacing: _gridCrossSpacing,mainAxisSpacing: _gridMainSpacing,- childAspectRatio: sideOfThumbnail / (sideOfThumbnail + 46),+ childAspectRatio:+ sideOfThumbnail / (sideOfThumbnail + gridItemTextHeight),),),);}+ double _gridItemTextHeight(BuildContext context) {+ final textScaler = MediaQuery.textScalerOf(context);+ return (_thumbnailToTextSpacing ++ _scaledLineHeight(textScaler, TextStyles.body) ++ _titleToSubtitleSpacing ++ _scaledLineHeight(textScaler, TextStyles.mini))+ .ceilToDouble();+ }++ double _scaledLineHeight(TextScaler textScaler, TextStyle style) {+ final fontSize = style.fontSize ?? 14;+ return textScaler.scale(fontSize) * (style.height ?? 1);+ }+Widget _buildFolderItem(DeviceCollection deviceCollection,double sideOfThumbnail,) {final colors = context.componentColors;+ final l10n = AppLocalizations.of(context);final isSelected = _selectedDevicePathIDs.contains(deviceCollection.id);final importedCount = _pathIDToItemCount?[deviceCollection.id];final formattedCount = NumberFormat().format(deviceCollection.count);final countText = kDebugMode && importedCount != null? "inApp: $importedCount | device: $formattedCount"- : formattedCount;+ : l10n.itemCount(count: deviceCollection.count);return GestureDetector(behavior: HitTestBehavior.opaque,@@ -329,40 +350,32 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {clipBehavior: Clip.none,alignment: Alignment.center,children: [- ClipRRect(- borderRadius: BorderRadius.circular(_thumbnailRadius + 1),- child: Container(- color: colors.strokeFaint,+ ClipSmoothRect(+ radius: SmoothBorderRadius(+ cornerRadius: _cornerRadius,+ cornerSmoothing: _cornerSmoothing,+ ),+ child: SizedBox(width: sideOfThumbnail,height: sideOfThumbnail,- ),- ),- Container(- padding: const EdgeInsets.all(1),- child: ClipRRect(- borderRadius: BorderRadius.circular(_thumbnailRadius),- child: SizedBox(- width: sideOfThumbnail - 2,- height: sideOfThumbnail - 2,- child: Stack(- fit: StackFit.expand,- children: [- if (deviceCollection.thumbnail != null)- ThumbnailWidget(- deviceCollection.thumbnail!,- shouldShowSyncStatus: false,- key: ValueKey(- "backup_selection_widget_${deviceCollection.id}",- ),- )- else- ColoredBox(color: colors.fillDark),- if (isSelected)- ColoredBox(- color: Colors.black.withValues(alpha: 0.4),+ child: Stack(+ fit: StackFit.expand,+ children: [+ if (deviceCollection.thumbnail != null)+ ThumbnailWidget(+ deviceCollection.thumbnail!,+ shouldShowSyncStatus: false,+ key: ValueKey(+ "backup_selection_widget_${deviceCollection.id}",),- ],- ),+ )+ else+ ColoredBox(color: colors.fillDark),+ if (isSelected)+ ColoredBox(+ color: Colors.black.withValues(alpha: 0.4),+ ),+ ],),),),@@ -387,22 +400,26 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {],),),- const SizedBox(height: 6),+ const SizedBox(height: _thumbnailToTextSpacing),SizedBox(width: sideOfThumbnail,child: Text(deviceCollection.name,+ textAlign: TextAlign.left,maxLines: 1,+ softWrap: false,overflow: TextOverflow.ellipsis,style: TextStyles.body.copyWith(color: colors.textBase),),),- const SizedBox(height: 2),+ const SizedBox(height: _titleToSubtitleSpacing),SizedBox(width: sideOfThumbnail,child: Text(countText,+ textAlign: TextAlign.left,maxLines: 1,+ softWrap: false,overflow: TextOverflow.ellipsis,style: TextStyles.mini.copyWith(color: colors.textLight),),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 157a446e86..af31bd9955 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@@ -28,20 +28,46 @@ Future<void> showAlbumsManageSheet(BuildContext context) {mainAxisSize: MainAxisSize.min,children: [_manageItem(- label: strings.trash,- icon: HugeIcons.strokeRoundedDelete01,- iconColor: const Color(0xFFE3505A),+ label: strings.links,+ icon: HugeIcons.strokeRoundedLink02,+ iconColor: colors.blue,onTap: () async {- final ok = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- strings.authToViewTrashedFiles,+ 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",+ ),+ ),+ );+ },+ ),+ 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,);- if (!ok || !context.mounted) return;+ collection ??= await CollectionsService.instance+ .getUncategorizedCollection();+ if (!context.mounted) return;if (sheetContext.mounted) {Navigator.of(sheetContext).pop();}- unawaited(routeToPage(context, TrashPage()));+ unawaited(routeToPage(context, UnCategorizedPage(collection)));},),const SizedBox(height: 8),@@ -57,7 +83,7 @@ Future<void> showAlbumsManageSheet(BuildContext context) {const SizedBox(height: 8),_manageItem(label: strings.hidden,- icon: HugeIcons.strokeRoundedViewOff,+ icon: HugeIcons.strokeRoundedViewOffSlash,iconColor: colors.accentOrange,onTap: () async {final ok = await LocalAuthenticationService.instance@@ -74,46 +100,20 @@ Future<void> showAlbumsManageSheet(BuildContext context) {),const SizedBox(height: 8),_manageItem(- label: strings.uncategorized,- icon: HugeIcons.strokeRoundedHelpCircle,- iconColor: colors.textLight,+ label: strings.trash,+ icon: HugeIcons.strokeRoundedDelete01,+ iconColor: const Color(0xFFE3505A),onTap: () async {- Collection? collection = CollectionsService.instance- .getActiveCollections()- .firstWhereOrNull(- (c) => c.type == CollectionType.uncategorized,+ final ok = await LocalAuthenticationService.instance+ .requestLocalAuthentication(+ context,+ strings.authToViewTrashedFiles,);- 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 (!ok || !context.mounted) return;if (sheetContext.mounted) {Navigator.of(sheetContext).pop();}- unawaited(- routeToPage(- context,- AllLinksPage(- quickLinks: data.collections.quickLinks,- memoryShares: data.memoryLinks,- titleHeroTag: "manage_links",- ),- ),- );+ unawaited(routeToPage(context, TrashPage()));},),],diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dartindex ecceb2fb66..0d30c7487c 100644--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart@@ -19,6 +19,7 @@ import "package:photos/models/collection/collection.dart";import "package:photos/models/selected_albums.dart";import "package:photos/service_locator.dart";import "package:photos/services/collections_service.dart";+import "package:photos/services/sync/remote_sync_service.dart";import "package:photos/theme/ente_theme.dart";import "package:photos/ui/collections/collection_list_page.dart";import "package:photos/ui/collections/device/device_folders_vertical_grid_view.dart";@@ -29,6 +30,7 @@ import "package:photos/ui/tabs/albums/albums_manage_sheet.dart";import "package:photos/ui/tabs/albums/empty_states/on_ente_empty_state.dart";import "package:photos/ui/tabs/albums/empty_states/shared_empty_state.dart";import "package:photos/ui/viewer/actions/album_selection_overlay_bar.dart";+import "package:photos/ui/viewer/actions/delete_empty_albums.dart";import "package:photos/utils/local_settings.dart";enum _AlbumsFilter { ente, onDevice, shared }@@ -66,6 +68,7 @@ class _AlbumsTabState extends State<AlbumsTab>final ValueNotifier<List<Collection>?> _sharedCollections = ValueNotifier(null,);+ final ValueNotifier<bool> _shouldShowDeleteEmptyAlbums = ValueNotifier(false);late final ValueNotifier<AlbumViewType> _viewType = ValueNotifier(localSettings.albumViewType(),);@@ -77,6 +80,8 @@ class _AlbumsTabState extends State<AlbumsTab>);final TextEditingController _searchController = TextEditingController();final FocusNode _searchFocusNode = FocusNode();+ ScrollController _scrollController = ScrollController();+ final List<ScrollController> _retiredScrollControllers = [];bool _isSearchActive = false;String _searchQuery = "";@@ -182,6 +187,7 @@ class _AlbumsTabState extends State<AlbumsTab>if (!Configuration.instance.hasConfiguredAccount()) {_enteCollections.value = <Collection>[];_sharedCollections.value = <Collection>[];+ _shouldShowDeleteEmptyAlbums.value = false;return;}await Future.wait([_loadEnteCollections(), _loadSharedCollections()]);@@ -204,10 +210,29 @@ class _AlbumsTabState extends State<AlbumsTab>Future<void> _loadEnteCollections() async {final collections = await CollectionsService.instance.getCollectionForOnEnteSection();+ final shouldShowDeleteEmptyAlbums = await _shouldShowDeleteEmptyAlbumsFor(+ collections,+ );if (!mounted) return;+ _shouldShowDeleteEmptyAlbums.value = shouldShowDeleteEmptyAlbums;_enteCollections.value = collections;}+ Future<bool> _shouldShowDeleteEmptyAlbumsFor(+ List<Collection> collections,+ ) async {+ if (!RemoteSyncService.instance.isFirstRemoteSyncDone()) {+ return false;+ }+ final collectionIDToLatestTimeCount = await CollectionsService.instance+ .getCollectionIDToNewestFileTime();+ final emptyAlbumCount = collections.where((collection) {+ final latestTimeCount = collectionIDToLatestTimeCount[collection.id];+ return latestTimeCount == null;+ }).length;+ return emptyAlbumCount > 2;+ }+Future<void> _loadSharedCollections() async {final shared = await CollectionsService.instance.getSharedCollections();if (!mounted) return;@@ -218,6 +243,7 @@ class _AlbumsTabState extends State<AlbumsTab>if (_isLocalGalleryMode && filter != _AlbumsFilter.onDevice) return;if (_filter.value == filter) return;widget.selectedAlbums?.clearAll();+ _resetScrollForNextContent();_filter.value = filter;}@@ -244,6 +270,7 @@ class _AlbumsTabState extends State<AlbumsTab>}return;}+ _resetScrollForNextContent();setState(() {_isSearchActive = false;_searchQuery = "";@@ -253,6 +280,21 @@ class _AlbumsTabState extends State<AlbumsTab>}}+ void _resetScrollForNextContent() {+ final oldController = _scrollController;+ _retiredScrollControllers.add(oldController);+ _scrollController = ScrollController();+ Future<void>.delayed(+ _kContentTransitionDuration + const Duration(milliseconds: 50),+ () {+ if (!_retiredScrollControllers.remove(oldController)) {+ return;+ }+ oldController.dispose();+ },+ );+ }+List<Collection> _filterCollectionsByQuery(List<Collection> collections) {final query = _searchQuery.trim().toLowerCase();if (query.isEmpty) {@@ -267,18 +309,47 @@ class _AlbumsTabState extends State<AlbumsTab>required List<Collection> collections,required bool showCreateAlbum,required Widget emptyState,+ Widget? leadingSliver,}) {if (collections.isEmpty && _searchQuery.trim().isEmpty) {return SliverFillRemaining(hasScrollBody: false, child: emptyState);}- return CollectionsFlexiGridViewWidget(- _filterCollectionsByQuery(collections),- albumViewType: _viewType.value,- selectedAlbums: widget.selectedAlbums,- shrinkWrap: true,- shouldShowCreateAlbum: showCreateAlbum && !_hasSearchQuery,- enableSelectionMode: !_isSearchActive,+ final filteredCollections = _filterCollectionsByQuery(collections);++ return SliverMainAxisGroup(+ slivers: [+ if (leadingSliver != null) leadingSliver,+ CollectionsFlexiGridViewWidget(+ filteredCollections,+ albumViewType: _viewType.value,+ selectedAlbums: widget.selectedAlbums,+ shrinkWrap: true,+ shouldShowCreateAlbum: showCreateAlbum && !_hasSearchQuery,+ enableSelectionMode: !_isSearchActive,+ ),+ ],+ );+ }++ Widget _buildDeleteEmptyAlbumsActionSlot() {+ return AnimatedSize(+ duration: _kContentTransitionDuration,+ curve: Curves.easeOutCubic,+ alignment: Alignment.topCenter,+ child: AnimatedSwitcher(+ duration: _kContentTransitionDuration,+ switchInCurve: Curves.easeOutCubic,+ switchOutCurve: Curves.easeInCubic,+ child: _shouldShowDeleteEmptyAlbums.value+ ? DeleteEmptyAlbums(+ key: const ValueKey("delete_empty_albums_action"),+ onDeleted: () => _loadEnteCollections(),+ )+ : const SizedBox.shrink(+ key: ValueKey("delete_empty_albums_hidden"),+ ),+ ),);}@@ -450,6 +521,9 @@ class _AlbumsTabState extends State<AlbumsTab>collections: collections,showCreateAlbum: showCreateAlbum,emptyState: emptyState,+ leadingSliver: filter == _AlbumsFilter.ente && !_hasSearchQuery+ ? SliverToBoxAdapter(child: _buildDeleteEmptyAlbumsActionSlot())+ : null,);}@@ -602,9 +676,15 @@ class _AlbumsTabState extends State<AlbumsTab>_debouncer.cancelDebounceTimer();_searchController.dispose();_searchFocusNode.dispose();+ _scrollController.dispose();+ for (final controller in _retiredScrollControllers) {+ controller.dispose();+ }+ _retiredScrollControllers.clear();_filter.dispose();_enteCollections.dispose();_sharedCollections.dispose();+ _shouldShowDeleteEmptyAlbums.dispose();_viewType.dispose();_sortKey.dispose();_sortDirection.dispose();@@ -694,6 +774,11 @@ class _AlbumsTabState extends State<AlbumsTab>),),onChanged: (value) {+ final hadSearchQuery = _hasSearchQuery;+ if (!hadSearchQuery &&+ value.trim().isNotEmpty) {+ _resetScrollForNextContent();+ }setState(() {_searchQuery = value;});@@ -791,6 +876,19 @@ class _AlbumsTabState extends State<AlbumsTab>_AlbumsFilter.shared,),),+ const SizedBox(width: 8),+ _AlbumsFilterChip(+ label: strings.more,+ selected: false,+ trailing: const Icon(+ Icons.keyboard_arrow_down,+ size: 18,+ ),+ onTap: () =>+ showAlbumsManageSheet(+ context,+ ),+ ),],],),@@ -798,15 +896,6 @@ class _AlbumsTabState extends State<AlbumsTab>},),),- if (!localGalleryMode)- IconButtonComponent(- variant: IconButtonComponentVariant.primary,- shouldSurfaceExecutionStates: false,- icon: const HugeIcon(- icon: HugeIcons.strokeRoundedMoreVertical,- ),- onTap: () => showAlbumsManageSheet(context),- ),],),),@@ -818,6 +907,7 @@ class _AlbumsTabState extends State<AlbumsTab>_filter,_enteCollections,_sharedCollections,+ _shouldShowDeleteEmptyAlbums,_viewType,_sortKey,_sortDirection,@@ -842,10 +932,15 @@ class _AlbumsTabState extends State<AlbumsTab>transitionBuilder: (child, animation) {return FadeTransition(opacity: animation, child: child);},- child: CustomScrollView(+ child: Scrollbar(key: _contentStateKey(),- physics: const BouncingScrollPhysics(),- slivers: [_buildContentSliver(strings)],+ controller: _scrollController,+ interactive: true,+ child: CustomScrollView(+ controller: _scrollController,+ physics: const BouncingScrollPhysics(),+ slivers: [_buildContentSliver(strings)],+ ),),);},@@ -901,16 +996,19 @@ class _AlbumsFilterChip extends StatelessWidget {required this.label,required this.selected,required this.onTap,+ this.trailing,});final String label;final bool selected;final VoidCallback onTap;+ final Widget? trailing;@overrideWidget build(BuildContext context) {return TagChipComponent(label: label,+ trailing: trailing,state: selected? TagChipComponentState.selected: TagChipComponentState.unselected,diff --git a/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart b/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dartindex 32268c3d18..30e5e8762d 100644--- a/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart+++ b/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart@@ -278,7 +278,7 @@ class _UserCollectionsTabState extends State<UserCollectionsTab>),),),- SliverToBoxAdapter(child: DeleteEmptyAlbums(collections)),+ const SliverToBoxAdapter(child: DeleteEmptyAlbums()),localGalleryMode? const SliverToBoxAdapter(child: EmptyOnEnteSection()): Configuration.instance.hasConfiguredAccount()diff --git a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dartindex f024c668ca..af7c6feb2c 100644--- a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart+++ b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart@@ -1,3 +1,4 @@+import "package:ente_components/ente_components.dart";import 'package:flutter/material.dart';import 'package:photos/core/event_bus.dart';import "package:photos/db/files_db.dart";@@ -6,15 +7,11 @@ import "package:photos/generated/l10n.dart";import 'package:photos/models/collection/collection.dart';import 'package:photos/models/file/file.dart';import 'package:photos/services/collections_service.dart';-import "package:photos/services/sync/remote_sync_service.dart";-import "package:photos/theme/ente_theme.dart";-import 'package:photos/ui/components/action_sheet_widget.dart';-import 'package:photos/ui/components/buttons/button_widget.dart';-import 'package:photos/ui/components/models/button_type.dart';class DeleteEmptyAlbums extends StatefulWidget {- final List<Collection> collections;- const DeleteEmptyAlbums(this.collections, {super.key});+ final Future<void> Function()? onDeleted;++ const DeleteEmptyAlbums({super.key, this.onDeleted});@overrideState<DeleteEmptyAlbums> createState() => _DeleteEmptyAlbumsState();@@ -30,109 +27,65 @@ class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {super.dispose();}- Future<bool> _showDeleteButton() async {- if (!RemoteSyncService.instance.isFirstRemoteSyncDone()) {- return Future.value(false);- }- final Map<int, int> collectionIDToLatestTimeCount = await CollectionsService- .instance- .getCollectionIDToNewestFileTime();- final emptyAlbumCount = widget.collections- .where((collection) {- final latestTimeCount = collectionIDToLatestTimeCount[collection.id];- return latestTimeCount == null;- })- .toList()- .length;- return emptyAlbumCount > 2;- }-@overrideWidget build(BuildContext context) {- return FutureBuilder<bool>(- future: _showDeleteButton(),- builder: (context, snapshot) {- if (snapshot.hasData && snapshot.data!) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);- return Padding(- padding: const EdgeInsets.fromLTRB(8.5, 4, 8, 12),- child: Align(- alignment: Alignment.centerLeft,- child: GestureDetector(- child: Container(- decoration: BoxDecoration(- color: colorScheme.fillFaint,- borderRadius: const BorderRadius.all(Radius.circular(4)),- ),- child: Padding(- padding: const EdgeInsets.symmetric(- vertical: 10,- horizontal: 12,- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- const Icon(Icons.delete_sweep_outlined, size: 18),- const SizedBox(width: 8),- Text(- AppLocalizations.of(context).deleteEmptyAlbums,- style: textTheme.smallBold,- ),- ],- ),- ),- ),- onTap: () async {- await showActionSheet(- context: context,- isDismissible: true,- buttons: [- ButtonWidget(- labelText: AppLocalizations.of(context).yes,- buttonType: ButtonType.neutral,- buttonSize: ButtonSize.large,- shouldStickToDarkTheme: true,- shouldSurfaceExecutionStates: true,- isInAlert: true,- progressStatus: _deleteProgress,- onTap: () async {- await _deleteEmptyAlbums();- Bus.instance.fire(- CollectionUpdatedEvent(- 0,- <EnteFile>[],- "empty_albums_deleted",- ),- );- CollectionsService.instance.sync().ignore();- _isCancelled = false;- },- ),- ButtonWidget(- labelText: AppLocalizations.of(context).cancel,- buttonType: ButtonType.secondary,- buttonSize: ButtonSize.large,- shouldStickToDarkTheme: true,- isInAlert: true,- onTap: () async {- _isCancelled = true;- },- ),- ],- title: AppLocalizations.of(- context,- ).deleteEmptyAlbumsWithQuestionMark,- body: AppLocalizations.of(context).deleteAlbumsDialogBody,- actionSheetType: ActionSheetType.defaultActionSheet,- );- },- ),+ final colors = context.componentColors;+ return GestureDetector(+ behavior: HitTestBehavior.translucent,+ onTap: _confirmAndDeleteEmptyAlbums,+ child: Align(+ alignment: Alignment.centerLeft,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),+ child: Text(+ AppLocalizations.of(context).deleteEmptyAlbums,+ style: TextStyles.body.copyWith(+ color: colors.textBase,+ decoration: TextDecoration.underline,+ decorationColor: colors.textBase,),- );- }- return const SizedBox.shrink();- },+ ),+ ),+ ),+ );+ }++ Future<void> _confirmAndDeleteEmptyAlbums() async {+ final l10n = AppLocalizations.of(context);+ await showBottomSheetComponent<void>(+ context: context,+ isDismissible: true,+ builder: (sheetContext) => BottomSheetComponent(+ title: l10n.deleteEmptyAlbumsWithQuestionMark,+ message: l10n.deleteAlbumsDialogBody,+ illustration: Image.asset("assets/warning-grey.png"),+ closeTooltip: l10n.close,+ onClose: () {+ _isCancelled = true;+ },+ actions: [+ ButtonComponent(+ label: l10n.yes,+ variant: ButtonComponentVariant.critical,+ shouldSurfaceExecutionStates: true,+ progressStatus: _deleteProgress,+ onTap: () async {+ _isCancelled = false;+ _deleteProgress.value = "";+ await _deleteEmptyAlbums();+ Bus.instance.fire(+ CollectionUpdatedEvent(0, <EnteFile>[], "empty_albums_deleted"),+ );+ CollectionsService.instance.sync().ignore();+ _isCancelled = false;+ await widget.onDeleted?.call();+ if (sheetContext.mounted) {+ Navigator.of(sheetContext).pop();+ }+ },+ ),+ ],+ ),);}