Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge branch 'main' into album

AmanRajSinghMourya2e03a375af6d
diff --cc mobile/apps/photos/lib/ui/collections/device/device_folder_list_item.dart
index b2ecf812da,0000000000..2b63bee905
mode 100644,000000..100644
--- a/mobile/apps/photos/lib/ui/collections/device/device_folder_list_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/device/device_folder_list_item.dart
@@@ -1,101 -1,0 +1,101 @@@
+import 'package:ente_pure_utils/ente_pure_utils.dart';
+import 'package:flutter/material.dart';
+import 'package:photos/generated/l10n.dart';
+import 'package:photos/models/device_collection.dart';
+import "package:photos/service_locator.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/collection_share_badge.dart";
+import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
+import 'package:photos/ui/viewer/gallery/device_folder_page.dart';
+
+class DeviceFolderListItem extends StatelessWidget {
+ static const _thumbSize = 52.0;
+ static const _cornerRadius = 12.0;
+ static const _rowHeight = 68.0;
+ static const _cardRadius = 20.0;
+ static const _padding = 8.0;
+
+ final DeviceCollection deviceCollection;
+
+ const DeviceFolderListItem(
+ this.deviceCollection, {
+ super.key,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final isBackedUp = deviceCollection.shouldBackup;
+
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ routeToPage(context, DeviceFolderPage(deviceCollection));
+ },
+ child: Container(
+ height: _rowHeight,
+ padding: const EdgeInsets.all(_padding),
+ decoration: BoxDecoration(
+ color: colorScheme.fill,
+ borderRadius: const BorderRadius.all(Radius.circular(_cardRadius)),
+ ),
+ child: Row(
+ children: [
+ SizedBox(
+ height: _thumbSize,
+ width: _thumbSize,
+ child: Stack(
+ clipBehavior: Clip.none,
+ children: [
+ ClipRRect(
+ borderRadius: BorderRadius.circular(_cornerRadius),
+ child: SizedBox(
+ height: _thumbSize,
+ width: _thumbSize,
+ child: ThumbnailWidget(
+ deviceCollection.thumbnail!,
+ shouldShowSyncStatus: false,
+ key: Key(
+ "device_folder:" +
+ deviceCollection.name +
+ deviceCollection.thumbnail!.tag,
+ ),
+ ),
+ ),
+ ),
- if (!isBackedUp && !isOfflineMode)
++ if (!isBackedUp && !isLocalGalleryMode)
+ const Positioned(
+ right: -4,
+ bottom: -4,
+ child: CollectionUnSyncedBadge(showBorder: true),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ deviceCollection.name,
+ overflow: TextOverflow.ellipsis,
+ ),
+ const SizedBox(height: 4),
+ Text(
+ AppLocalizations.of(context).itemCount(
+ count: deviceCollection.count,
+ ),
+ style: textTheme.smallMuted,
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --cc mobile/apps/photos/lib/ui/collections/device/device_folder_row_item.dart
index 8f1b47753e,56927f3410..b0f4b3a178
--- a/mobile/apps/photos/lib/ui/collections/device/device_folder_row_item.dart
+++ b/mobile/apps/photos/lib/ui/collections/device/device_folder_row_item.dart
@@@ -61,12 -73,8 +61,12 @@@ class DeviceFolderRowItem extends State
deviceCollection.thumbnail!.tag,
),
),
- if (!isBackedUp && !isOfflineMode)
+ if (!isBackedUp && !isLocalGalleryMode)
- const UnSyncedIcon(),
+ const Positioned(
+ right: _overlayPadding,
+ bottom: _overlayPadding,
+ child: CollectionUnSyncedBadge(),
+ ),
],
),
),
diff --cc mobile/apps/photos/lib/ui/settings/notification_settings_screen.dart
index a761d0ed3d,b79289b32f..ba20bf4b6e
--- a/mobile/apps/photos/lib/ui/settings/notification_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/notification_settings_screen.dart
@@@ -13,10 -13,14 +13,10 @@@ class NotificationSettingsScreen extend
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final showOnlyOnThisDay = isOfflineMode;
- final isDarkMode = Theme.of(context).brightness == Brightness.dark;
+ final showOnlyOnThisDay = isLocalGalleryMode;
- final pageBackgroundColor =
- isDarkMode ? const Color(0xFF161616) : const Color(0xFFFAFAFA);
-
return Scaffold(
- backgroundColor: pageBackgroundColor,
+ backgroundColor: colorScheme.backgroundColour,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
diff --cc mobile/apps/photos/lib/ui/settings/security/security_settings_page.dart
index e68d73ec24,80614bcfe7..a685b91705
--- a/mobile/apps/photos/lib/ui/settings/security/security_settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/security/security_settings_page.dart
@@@ -62,11 -62,15 +62,11 @@@ class _SecuritySettingsPageState extend
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final isDarkMode = Theme.of(context).brightness == Brightness.dark;
final showAccountSecurity =
- _config.hasConfiguredAccount() && !isOfflineMode;
+ _config.hasConfiguredAccount() && !isLocalGalleryMode;
- final pageBackgroundColor =
- isDarkMode ? const Color(0xFF161616) : const Color(0xFFFAFAFA);
-
return Scaffold(
- backgroundColor: pageBackgroundColor,
+ backgroundColor: colorScheme.backgroundColour,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
diff --cc mobile/apps/photos/lib/ui/settings_page.dart
index 0940906378,83d531ddf5..36128d3bbb
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@@ -68,12 -68,16 +68,12 @@@ class _SettingsBody extends StatelessWi
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
- final isDarkMode = Theme.of(context).brightness == Brightness.dark;
final hasLoggedIn = Configuration.instance.isLoggedIn();
final hasConfiguredAccount = Configuration.instance.hasConfiguredAccount();
- final showLoginEntry = isOfflineMode && !hasConfiguredAccount;
+ final showLoginEntry = isLocalGalleryMode && !hasConfiguredAccount;
- final pageBackgroundColor =
- isDarkMode ? const Color(0xFF161616) : const Color(0xFFFAFAFA);
-
return Container(
- color: pageBackgroundColor,
+ color: colorScheme.backgroundColour,
child: SafeArea(
bottom: false,
child: SingleChildScrollView(
diff --cc mobile/apps/photos/lib/ui/social/feed_screen.dart
index d3264af260,94ab367b44..1292b9f9ed
--- a/mobile/apps/photos/lib/ui/social/feed_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/feed_screen.dart
@@@ -576,10 -537,7 +576,10 @@@ class _FeedScreenState extends State<Fe
body: _isLoading
? const Center(child: EnteLoadingWidget(size: 24))
: _feedItems.isEmpty
- ? _buildEmptyState(context)
+ ? FeedEmptyState(
- offlineUiMode: isOfflineMode &&
++ localGalleryMode: isLocalGalleryMode &&
+ !Configuration.instance.hasConfiguredAccount(),
+ )
: RefreshIndicator(
onRefresh: _onRefresh,
child: ListView.builder(
diff --cc mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
index 0df4622755,0000000000..10d5c0ece8
mode 100644,000000..100644
--- a/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
@@@ -1,128 -1,0 +1,128 @@@
+import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
+import "package:photos/generated/l10n.dart";
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/account/email_entry_page.dart";
+import "package:photos/ui/collections/collection_action_sheet.dart";
+import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/tabs/albums/empty_states/empty_state_feature_row.dart";
+
+class FeedEmptyState extends StatelessWidget {
+ const FeedEmptyState({
- required this.offlineUiMode,
++ required this.localGalleryMode,
+ super.key,
+ });
+
- final bool offlineUiMode;
++ final bool localGalleryMode;
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final strings = AppLocalizations.of(context);
+ final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
+
+ return Align(
+ alignment: Alignment.bottomCenter,
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 320),
+ child: Column(
+ children: [
+ Text(
- offlineUiMode
++ localGalleryMode
+ ? strings.seeWhatYourPeopleAreUpTo
+ : strings.nothingHereYet,
+ textAlign: TextAlign.center,
+ style: textTheme.largeBold.copyWith(
+ fontFamily: "Nunito",
+ fontWeight: FontWeight.w800,
+ fontSize: 18,
+ height: 28 / 18,
+ color: colorScheme.content,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(
- offlineUiMode
++ localGalleryMode
+ ? strings.signUpToShareMomentsPrivately
+ : strings.shareAnAlbumWithSomeoneYouLove,
+ textAlign: TextAlign.center,
+ style: textTheme.miniMuted,
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: 32),
+ ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 320),
+ child: Column(
- children: offlineUiMode
++ children: localGalleryMode
+ ? [
+ EmptyStateFeatureRow(
+ icon: HugeIcons.strokeRoundedFavourite,
+ label: strings.reactToTheMomentsThatMatter,
+ ),
+ const SizedBox(height: 24),
+ EmptyStateFeatureRow(
+ icon: HugeIcons.strokeRoundedComment01,
+ label: strings.leaveANoteOnTheMomentsSharedWithYou,
+ ),
+ const SizedBox(height: 24),
+ EmptyStateFeatureRow(
+ icon: HugeIcons.strokeRoundedLockSync01,
+ label:
+ strings.endToEndEncryptedOnlyYourPeopleCanSeeIt,
+ ),
+ ]
+ : [
+ EmptyStateFeatureRow(
+ icon: HugeIcons.strokeRoundedFavourite,
+ label: strings.seeTheLoveYourPhotosGet,
+ ),
+ const SizedBox(height: 24),
+ EmptyStateFeatureRow(
+ icon: HugeIcons.strokeRoundedComment01,
+ label: strings.yourConversationsAttachedToTheMoment,
+ ),
+ const SizedBox(height: 24),
+ EmptyStateFeatureRow(
+ icon: HugeIcons.strokeRoundedUserMultiple,
+ label: strings.stayConnectedWithThePeopleYouShareWith,
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: 32),
+ ButtonWidgetV2(
+ buttonType: ButtonTypeV2.primary,
+ labelText:
- offlineUiMode ? strings.getStarted : strings.shareAnAlbum,
++ localGalleryMode ? strings.getStarted : strings.shareAnAlbum,
+ onTap: () async {
- if (offlineUiMode) {
++ if (localGalleryMode) {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
+ ),
+ ),
+ );
+ return;
+ }
+ showCollectionActionSheet(
+ context,
+ actionType: CollectionActionType.shareCollection,
+ );
+ },
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --cc mobile/apps/photos/lib/ui/tabs/albums_tab.dart
index 2c46c55dfe,0000000000..ef6bba97ef
mode 100644,000000..100644
--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
@@@ -1,635 -1,0 +1,635 @@@
+import "dart:async";
+
+import "package:ente_pure_utils/ente_pure_utils.dart";
+import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
+import "package:photos/core/configuration.dart";
+import "package:photos/core/event_bus.dart";
+import "package:photos/events/album_sort_order_change_event.dart";
+import "package:photos/events/app_mode_changed_event.dart";
+import "package:photos/events/backup_folders_updated_event.dart";
+import "package:photos/events/collection_meta_event.dart";
+import "package:photos/events/collection_updated_event.dart";
+import "package:photos/events/favorites_service_init_complete_event.dart";
+import "package:photos/events/local_photos_updated_event.dart";
+import "package:photos/events/user_logged_out_event.dart";
+import "package:photos/generated/l10n.dart";
+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/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";
+import "package:photos/ui/collections/flex_grid_view.dart";
+import "package:photos/ui/common/loading_widget.dart";
+import "package:photos/ui/components/buttons/filter_pill_widget.dart";
+import "package:photos/ui/components/buttons/soft_icon_button.dart";
+import "package:photos/ui/components/popup_menu/ente_popup_menu_button.dart";
+import "package:photos/ui/components/text_input_widget_v2.dart";
+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/utils/local_settings.dart";
+
+enum _AlbumsFilter { ente, onDevice, shared }
+
+enum _AlbumsMenuAction { toggleView, name, newest, updated }
+
+class AlbumsTab extends StatefulWidget {
+ const AlbumsTab({super.key, this.selectedAlbums});
+
+ final SelectedAlbums? selectedAlbums;
+
+ @override
+ State<AlbumsTab> createState() => _AlbumsTabState();
+}
+
+class _AlbumsTabState extends State<AlbumsTab>
+ with AutomaticKeepAliveClientMixin {
+ static const double _kHeaderToolbarHeight = 72;
+
+ final ValueNotifier<_AlbumsFilter> _filter =
+ ValueNotifier(_AlbumsFilter.ente);
+ final ValueNotifier<List<Collection>?> _enteCollections = ValueNotifier(null);
+ final ValueNotifier<List<Collection>?> _sharedCollections =
+ ValueNotifier(null);
+ late final ValueNotifier<AlbumViewType> _viewType =
+ ValueNotifier(localSettings.albumViewType());
+ late final ValueNotifier<AlbumSortKey> _sortKey =
+ ValueNotifier(localSettings.albumSortKey());
+ late final ValueNotifier<AlbumSortDirection> _sortDirection =
+ ValueNotifier(localSettings.albumSortDirection());
+ final TextEditingController _searchController = TextEditingController();
+ final FocusNode _searchFocusNode = FocusNode();
+
+ bool _isSearchActive = false;
+ String _searchQuery = "";
+
+ late final StreamSubscription<CollectionMetaEvent>
+ _collectionMetaEventSubscription;
+ late final StreamSubscription<CollectionUpdatedEvent>
+ _collectionUpdatesSubscription;
+ late final StreamSubscription<LocalPhotosUpdatedEvent>
+ _localFilesSubscription;
+ late final StreamSubscription<FavoritesServiceInitCompleteEvent>
+ _favoritesInitComplete;
+ late final StreamSubscription<AlbumSortOrderChangeEvent>
+ _albumSortOrderChangeEvent;
+ late final StreamSubscription<BackupFoldersUpdatedEvent>
+ _backupFoldersUpdatedEvent;
+ late final StreamSubscription<AppModeChangedEvent> _appModeChangedEvent;
+ late final StreamSubscription<UserLoggedOutEvent> _loggedOutEvent;
+
+ final _debouncer = Debouncer(
+ const Duration(seconds: 2),
+ executionInterval: const Duration(seconds: 5),
+ leading: true,
+ );
+
+ @override
+ void initState() {
+ super.initState();
+ unawaited(_loadAll());
+
+ _collectionMetaEventSubscription =
+ Bus.instance.on<CollectionMetaEvent>().listen((_) {
+ _debouncer.run(_loadAll);
+ });
+ _collectionUpdatesSubscription =
+ Bus.instance.on<CollectionUpdatedEvent>().listen((_) {
+ _debouncer.run(_loadAll);
+ });
+ _localFilesSubscription =
+ Bus.instance.on<LocalPhotosUpdatedEvent>().listen((_) {
+ _debouncer.run(_loadAll);
+ });
+ _albumSortOrderChangeEvent =
+ Bus.instance.on<AlbumSortOrderChangeEvent>().listen((_) {
+ _syncSortState();
+ unawaited(_loadAll());
+ });
+ _favoritesInitComplete =
+ Bus.instance.on<FavoritesServiceInitCompleteEvent>().listen((_) {
+ _debouncer.run(_loadAll);
+ });
+ _backupFoldersUpdatedEvent =
+ Bus.instance.on<BackupFoldersUpdatedEvent>().listen((_) {
+ if (mounted) {
+ setState(() {});
+ }
+ _debouncer.run(_loadAll);
+ });
+ _appModeChangedEvent = Bus.instance.on<AppModeChangedEvent>().listen((_) {
+ if (mounted) {
+ setState(() {});
+ }
+ _debouncer.run(_loadAll);
+ });
+ _loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((_) {
+ _enteCollections.value = null;
+ _sharedCollections.value = null;
+ });
+ }
+
+ Future<void> _loadAll() async {
+ if (!Configuration.instance.hasConfiguredAccount()) {
+ _enteCollections.value = <Collection>[];
+ _sharedCollections.value = <Collection>[];
+ return;
+ }
+ await Future.wait([_loadEnteCollections(), _loadSharedCollections()]);
+ }
+
+ bool get _isLocalGalleryMode =>
- isOfflineMode && !Configuration.instance.hasConfiguredAccount();
++ isLocalGalleryMode && !Configuration.instance.hasConfiguredAccount();
+
+ _AlbumsFilter get _effectiveFilter =>
+ _isLocalGalleryMode ? _AlbumsFilter.onDevice : _filter.value;
+
+ void _syncSortState() {
+ _sortKey.value = localSettings.albumSortKey();
+ _sortDirection.value = localSettings.albumSortDirection();
+ _viewType.value = localSettings.albumViewType();
+ }
+
+ Future<void> _loadEnteCollections() async {
+ final collections =
+ await CollectionsService.instance.getCollectionForOnEnteSection();
+ if (!mounted) return;
+ _enteCollections.value = collections;
+ }
+
+ Future<void> _loadSharedCollections() async {
+ final shared = await CollectionsService.instance.getSharedCollections();
+ if (!mounted) return;
+ _sharedCollections.value = shared.incoming;
+ }
+
+ void _selectFilter(_AlbumsFilter filter) {
+ if (_isLocalGalleryMode && filter != _AlbumsFilter.onDevice) return;
+ if (_filter.value == filter) return;
+ widget.selectedAlbums?.clearAll();
+ _filter.value = filter;
+ }
+
+ void _activateSearch() {
+ if (_isSearchActive) return;
+ setState(() {
+ _isSearchActive = true;
+ });
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (mounted) {
+ _searchFocusNode.requestFocus();
+ }
+ });
+ }
+
+ void _deactivateSearch() {
+ _searchController.clear();
+ _searchFocusNode.unfocus();
+ if (!_isSearchActive && _searchQuery.isEmpty) return;
+ setState(() {
+ _isSearchActive = false;
+ _searchQuery = "";
+ });
+ }
+
+ List<Collection> _filterCollectionsByQuery(List<Collection> collections) {
+ final query = _searchQuery.trim().toLowerCase();
+ if (query.isEmpty) {
+ return collections;
+ }
+ return collections
+ .where((c) => c.displayName.toLowerCase().contains(query))
+ .toList();
+ }
+
+ Widget _buildCollectionContentSliver({
+ required List<Collection> collections,
+ required bool showCreateAlbum,
+ required Widget emptyState,
+ }) {
+ 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 && _searchQuery.trim().isEmpty,
+ enableSelectionMode: true,
+ );
+ }
+
+ Future<void> _toggleViewMode() async {
+ final next = _viewType.value == AlbumViewType.grid
+ ? AlbumViewType.list
+ : AlbumViewType.grid;
+ _viewType.value = next;
+ await localSettings.setAlbumViewType(next);
+ }
+
+ Future<void> _setSortMode(AlbumSortKey key) async {
+ AlbumSortDirection nextDirection;
+ if (_sortKey.value == key) {
+ nextDirection = _sortDirection.value == AlbumSortDirection.ascending
+ ? AlbumSortDirection.descending
+ : AlbumSortDirection.ascending;
+ } else {
+ nextDirection = AlbumSortDirection.ascending;
+ }
+
+ _sortKey.value = key;
+ _sortDirection.value = nextDirection;
+ await localSettings.setAlbumSortKey(key);
+ await localSettings.setAlbumSortDirection(nextDirection);
+ if (mounted) {
+ Bus.instance.fire(AlbumSortOrderChangeEvent());
+ }
+ }
+
+ List<EntePopupMenuOption<_AlbumsMenuAction>> _buildAlbumsMenuOptions() {
+ final colorScheme = getEnteColorScheme(context);
+ final strings = AppLocalizations.of(context);
+ final isListView = _viewType.value == AlbumViewType.list;
+ final showSortActions = _effectiveFilter != _AlbumsFilter.onDevice;
+ final currentSortKey = _sortKey.value;
+ final currentSortDirection = _sortDirection.value;
+ final nameSortDirection =
+ currentSortKey == AlbumSortKey.albumName ? currentSortDirection : null;
+ final activeTrailingWidget = HugeIcon(
+ icon: currentSortDirection == AlbumSortDirection.ascending
+ ? HugeIcons.strokeRoundedArrowUp02
+ : HugeIcons.strokeRoundedArrowDown02,
+ size: 12,
+ strokeWidth: 3,
+ color: colorScheme.textMuted,
+ );
+
+ return [
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.toggleView,
+ label: isListView ? strings.grid : strings.list,
+ showDivider: showSortActions,
+ trailingWidget: HugeIcon(
+ icon: isListView
+ ? HugeIcons.strokeRoundedGridView
+ : HugeIcons.strokeRoundedMenu01,
+ size: 12,
+ strokeWidth: 3,
+ color: colorScheme.contentLight,
+ ),
+ ),
+ if (showSortActions) ...[
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.name,
+ label: strings.name,
+ secondaryLabel: nameSortDirection != AlbumSortDirection.descending
+ ? strings.sortAToZ
+ : strings.sortZToA,
+ isActive: currentSortKey == AlbumSortKey.albumName,
+ activeTrailingWidget: activeTrailingWidget,
+ ),
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.newest,
+ label: strings.newest,
+ isActive: currentSortKey == AlbumSortKey.newestPhoto,
+ activeTrailingWidget: activeTrailingWidget,
+ ),
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.updated,
+ label: strings.updated,
+ isActive: currentSortKey == AlbumSortKey.lastUpdated,
+ activeTrailingWidget: activeTrailingWidget,
+ showDivider: false,
+ ),
+ ],
+ ];
+ }
+
+ Future<void> _handleAlbumsMenuSelection(_AlbumsMenuAction selected) async {
+ switch (selected) {
+ case _AlbumsMenuAction.toggleView:
+ await _toggleViewMode();
+ break;
+ case _AlbumsMenuAction.name:
+ await _setSortMode(AlbumSortKey.albumName);
+ break;
+ case _AlbumsMenuAction.newest:
+ await _setSortMode(AlbumSortKey.newestPhoto);
+ break;
+ case _AlbumsMenuAction.updated:
+ await _setSortMode(AlbumSortKey.lastUpdated);
+ break;
+ }
+ }
+
+ @override
+ void dispose() {
+ _collectionMetaEventSubscription.cancel();
+ _collectionUpdatesSubscription.cancel();
+ _localFilesSubscription.cancel();
+ _favoritesInitComplete.cancel();
+ _albumSortOrderChangeEvent.cancel();
+ _backupFoldersUpdatedEvent.cancel();
+ _appModeChangedEvent.cancel();
+ _loggedOutEvent.cancel();
+ _debouncer.cancelDebounceTimer();
+ _searchController.dispose();
+ _searchFocusNode.dispose();
+ _filter.dispose();
+ _enteCollections.dispose();
+ _sharedCollections.dispose();
+ _viewType.dispose();
+ _sortKey.dispose();
+ _sortDirection.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ super.build(context);
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final strings = AppLocalizations.of(context);
+ final selectedAlbums = widget.selectedAlbums;
+ final localGalleryMode = _isLocalGalleryMode;
+ return Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ SafeArea(
+ bottom: false,
+ child: Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: SizedBox(
+ height: _kHeaderToolbarHeight,
+ child: Row(
+ children: [
+ Expanded(
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 220),
+ switchInCurve: Curves.easeOutCubic,
+ switchOutCurve: Curves.easeInCubic,
+ layoutBuilder: (currentChild, previousChildren) =>
+ Stack(
+ alignment: Alignment.centerLeft,
+ children: [
+ ...previousChildren,
+ if (currentChild != null) currentChild,
+ ],
+ ),
+ transitionBuilder: (child, animation) {
+ final curvedAnimation = CurvedAnimation(
+ parent: animation,
+ curve: Curves.easeOutCubic,
+ reverseCurve: Curves.easeInCubic,
+ );
+ final beginOffset =
+ child.key == const ValueKey("search_title")
+ ? const Offset(0.04, 0)
+ : const Offset(-0.04, 0);
+ return FadeTransition(
+ opacity: curvedAnimation,
+ child: SlideTransition(
+ position: Tween<Offset>(
+ begin: beginOffset,
+ end: Offset.zero,
+ ).animate(curvedAnimation),
+ child: child,
+ ),
+ );
+ },
+ child: _isSearchActive
+ ? Row(
+ key: const ValueKey("search_title"),
+ children: [
+ Expanded(
+ child: TextInputWidgetV2(
+ textEditingController:
+ _searchController,
+ focusNode: _searchFocusNode,
+ hintText: strings.searchAlbums,
+ autoFocus: true,
+ shouldSurfaceExecutionStates: false,
+ leadingWidget: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ size: 18,
+ color: colorScheme.textMuted,
+ ),
+ trailingWidget: GestureDetector(
+ onTap: _deactivateSearch,
+ child: HugeIcon(
+ icon:
+ HugeIcons.strokeRoundedCancel01,
+ size: 18,
+ color: colorScheme.textMuted,
+ ),
+ ),
+ onChange: (value) {
+ setState(() {
+ _searchQuery = value;
+ });
+ },
+ ),
+ ),
+ if (!localGalleryMode) ...[
+ const SizedBox(width: 20),
+ SoftIconButton(
+ icon: HugeIcon(
+ icon: HugeIcons
+ .strokeRoundedFilterHorizontal,
+ size: 18,
+ color: colorScheme.textBase,
+ ),
+ onTap: () => showAlbumsManageSheet(
+ context,
+ ),
+ ),
+ ],
+ ],
+ )
+ : Text(
+ strings.albums,
+ key: const ValueKey("albums_title"),
+ style: textTheme.h4Bold,
+ ),
+ ),
+ ),
+ if (!_isSearchActive) ...[
+ SoftIconButton(
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ size: 18,
+ color: colorScheme.textBase,
+ ),
+ onTap: _activateSearch,
+ ),
+ if (!localGalleryMode) ...[
+ const SizedBox(width: 6),
+ SoftIconButton(
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedFilterHorizontal,
+ size: 18,
+ color: colorScheme.textBase,
+ ),
+ onTap: () => showAlbumsManageSheet(context),
+ ),
+ ],
+ ],
+ ],
+ ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 24),
+ child: Row(
+ children: [
+ Expanded(
+ child: ValueListenableBuilder<_AlbumsFilter>(
+ valueListenable: _filter,
+ builder: (context, selected, _) {
+ final effectiveFilter = localGalleryMode
+ ? _AlbumsFilter.onDevice
+ : selected;
+ return Row(
+ children: [
+ if (!localGalleryMode) ...[
+ FilterPillWidget(
+ label: strings.ente,
+ selected:
+ effectiveFilter == _AlbumsFilter.ente,
+ onTap: () =>
+ _selectFilter(_AlbumsFilter.ente),
+ ),
+ const SizedBox(width: 8),
+ ],
+ FilterPillWidget(
+ label: strings.onDevice,
+ selected:
+ effectiveFilter == _AlbumsFilter.onDevice,
+ onTap: () =>
+ _selectFilter(_AlbumsFilter.onDevice),
+ ),
+ if (!localGalleryMode) ...[
+ const SizedBox(width: 8),
+ FilterPillWidget(
+ label: strings.searchResultShared,
+ selected:
+ effectiveFilter == _AlbumsFilter.shared,
+ onTap: () =>
+ _selectFilter(_AlbumsFilter.shared),
+ ),
+ ],
+ ],
+ );
+ },
+ ),
+ ),
+ EntePopupMenuButton<_AlbumsMenuAction>(
+ optionsBuilder: _buildAlbumsMenuOptions,
+ onSelected: _handleAlbumsMenuSelection,
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: CustomScrollView(
+ physics: const BouncingScrollPhysics(),
+ slivers: [
+ AnimatedBuilder(
+ animation: Listenable.merge(
+ [
+ _filter,
+ _enteCollections,
+ _sharedCollections,
+ _viewType,
+ ],
+ ),
+ builder: (context, _) {
+ final filter = _effectiveFilter;
+ final List<Collection>? collections;
+ final bool showCreateAlbum;
+ final Widget emptyState;
+ switch (filter) {
+ case _AlbumsFilter.ente:
+ collections = _enteCollections.value;
+ showCreateAlbum = true;
+ emptyState = const OnEnteEmptyState();
+ case _AlbumsFilter.shared:
+ collections = _sharedCollections.value;
+ showCreateAlbum = false;
+ emptyState = const SharedEmptyState();
+ case _AlbumsFilter.onDevice:
+ return DeviceFolderVerticalGridSliver(
+ searchQuery: _searchQuery,
+ albumViewType: _viewType.value,
+ );
+ }
+ if (collections == null) {
+ return const SliverToBoxAdapter(
+ child: Padding(
+ padding: EdgeInsets.symmetric(vertical: 24),
+ child: EnteLoadingWidget(),
+ ),
+ );
+ }
+ return _buildCollectionContentSliver(
+ collections: collections,
+ showCreateAlbum: showCreateAlbum,
+ emptyState: emptyState,
+ );
+ },
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (selectedAlbums != null)
+ AnimatedBuilder(
+ animation: Listenable.merge(
+ [_filter, _enteCollections, _sharedCollections],
+ ),
+ builder: (context, _) {
+ final filter = _effectiveFilter;
+ final UISectionType sectionType;
+ final List<Collection>? collections;
+ switch (filter) {
+ case _AlbumsFilter.ente:
+ sectionType = UISectionType.homeCollections;
+ collections = _enteCollections.value;
+ case _AlbumsFilter.shared:
+ sectionType = UISectionType.incomingCollections;
+ collections = _sharedCollections.value;
+ case _AlbumsFilter.onDevice:
+ return const SizedBox.shrink();
+ }
+ if (collections == null) return const SizedBox.shrink();
+ final filteredCollections =
+ _filterCollectionsByQuery(collections);
+ if (filteredCollections.isEmpty) return const SizedBox.shrink();
+ return AlbumSelectionOverlayBar(
+ selectedAlbums,
+ sectionType,
+ filteredCollections,
+ showSelectAllButton: true,
+ );
+ },
+ ),
+ ],
+ );
+ }
+
+ @override
+ bool get wantKeepAlive => true;
+}
diff --cc mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart
index cad1518542,ee6723a55a..3ddc7b6349
--- a/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart
@@@ -205,19 -223,17 +207,17 @@@ class _SharedCollectionsTabState extend
@override
Widget build(BuildContext context) {
super.build(context);
- final bool offlineUiMode =
- isOfflineMode && !Configuration.instance.hasConfiguredAccount();
- final bool localGalleryUiMode =
++ final bool localGalleryMode =
+ isLocalGalleryMode && !Configuration.instance.hasConfiguredAccount();
return FutureBuilder<SharedCollectionsAndMemoryLinks>(
- future: offlineUiMode
- future: localGalleryUiMode
++ future: localGalleryMode
? Future.value(SharedCollectionsAndMemoryLinks.empty())
: CollectionsService.instance.getSharedCollectionsAndMemoryLinks(),
builder: (context, snapshot) {
if (snapshot.hasData) {
final data = snapshot.data!;
- if (offlineUiMode) {
- return const SafeArea(
- child: SharedEmptyOfflineStateWidget(),
- );
- if (localGalleryUiMode) {
++ if (localGalleryMode) {
+ return const SafeArea(child: SharedEmptyOfflineStateWidget());
}
if (data.collections.incoming.isEmpty &&
data.collections.quickLinks.isEmpty &&
diff --cc mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart
index 6c95e7988b,b8d59a027b..04ff624e75
--- a/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart
@@@ -118,17 -120,17 +119,17 @@@ class _UserCollectionsTabState extends
Widget build(BuildContext context) {
super.build(context);
_logger.info("Building, trigger: $_loadReason");
- final bool offlineUiMode =
- isOfflineMode && !Configuration.instance.hasConfiguredAccount();
- final bool localGalleryUiMode =
++ final bool localGalleryMode =
+ isLocalGalleryMode && !Configuration.instance.hasConfiguredAccount();
return FutureBuilder<List<Collection>>(
- future: offlineUiMode
- future: localGalleryUiMode
++ future: localGalleryMode
? Future.value(<Collection>[])
: CollectionsService.instance.getCollectionForOnEnteSection(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return _getCollectionsGalleryWidget(
snapshot.data!,
- offlineUiMode: offlineUiMode,
- localGalleryUiMode: localGalleryUiMode,
++ localGalleryMode: localGalleryMode,
);
} else if (snapshot.hasError) {
return Text(snapshot.error.toString());
@@@ -141,7 -143,7 +142,7 @@@
Widget _getCollectionsGalleryWidget(
List<Collection> collections, {
- required bool offlineUiMode,
- required bool localGalleryUiMode,
++ required bool localGalleryMode,
}) {
final TextStyle trashAndHiddenTextStyle =
Theme.of(context).textTheme.titleMedium!.copyWith(
@@@ -221,7 -222,7 +221,7 @@@
const SliverToBoxAdapter(child: DeviceFoldersGridView()),
SliverToBoxAdapter(
child: SectionOptions(
- onTap: offlineUiMode
- onTap: localGalleryUiMode
++ onTap: localGalleryMode
? null
: () {
unawaited(
@@@ -238,7 -239,7 +238,7 @@@
);
},
SectionTitle(titleWithBrand: getOnEnteSection(context)),
- trailingWidget: offlineUiMode
- trailingWidget: localGalleryUiMode
++ trailingWidget: localGalleryMode
? null
: Row(
mainAxisSize: MainAxisSize.min,
@@@ -273,10 -274,8 +273,8 @@@
),
),
SliverToBoxAdapter(child: DeleteEmptyAlbums(collections)),
- offlineUiMode
- ? const SliverToBoxAdapter(
- child: EmptyOnEnteSection(),
- )
- localGalleryUiMode
++ localGalleryMode
+ ? const SliverToBoxAdapter(child: EmptyOnEnteSection())
: Configuration.instance.hasConfiguredAccount()
? CollectionsFlexiGridViewWidget(
collections,
@@@ -286,11 -286,9 +284,9 @@@
enableSelectionMode: true,
)
: const SliverToBoxAdapter(child: EmptyState()),
- if (!offlineUiMode) ...[
- if (!localGalleryUiMode) ...[
++ if (!localGalleryMode) ...[
SliverToBoxAdapter(
- child: Divider(
- color: colorScheme.strokeFaint,
- ),
+ child: Divider(color: colorScheme.strokeFaint),
),
const SliverToBoxAdapter(child: SizedBox(height: 12)),
SliverToBoxAdapter(
diff --cc mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
index 40b3653c96,5be568959c..24d1ade4d8
--- a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
@@@ -1270,11 -1303,12 +1303,11 @@@ class _MemoryLaneCard extends Stateless
child: Stack(
fit: StackFit.expand,
children: [
- _buildImage(blurSigma),
+ _buildImage(blurSigma, imageCacheWidth),
if (overlayOpacity > 0)
Container(
- color:
- colorScheme.backgroundColour.withValues(alpha: overlayOpacity),
- color: colorScheme.backgroundBase.withValues(
- alpha: overlayOpacity,
- ),
++ color: colorScheme.backgroundColour
++ .withValues(alpha: overlayOpacity),
),
if (frame.image == null)
Center(
diff --cc mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
index 1d876275dd,d4492738fc..a2cbc96104
--- a/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search_tab/search_tab.dart
@@@ -110,12 -110,15 +107,12 @@@ class _AllSearchSectionsState extends S
child: Stack(
children: [
FutureBuilder<List<List<SearchResult>>>(
- future: InheritedAllSectionsExamples.of(context)
- .allSectionsExamplesFuture,
+ future: InheritedAllSectionsExamples.of(
+ context,
+ ).allSectionsExamplesFuture,
builder: (context, snapshot) {
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
- if (!isOfflineMode &&
- // In offline mode, skip the empty state check since DeviceAlbumsSection
- // fetches its own data and may have albums to show
- if (!isLocalGalleryMode &&
-- snapshot.data!.every((element) => element.isEmpty)) {
++ if (snapshot.data!.every((element) => element.isEmpty)) {
return const Padding(
padding: EdgeInsets.only(bottom: 72),
child: SearchTabEmptyState(),
@@@ -161,9 -166,15 +160,9 @@@
as List<GenericSearchResult>,
);
case SectionType.album:
- if (isLocalGalleryMode) {
- return const DeviceAlbumsSection();
- }
- return AlbumsSection(
- snapshot.data!.elementAt(sectionIndex)
- as List<AlbumSearchResult>,
- );
+ return const SizedBox.shrink();
case SectionType.ritual:
- if (isOfflineMode) {
+ if (isLocalGalleryMode) {
return const SizedBox.shrink();
}
return const _RitualsDiscoverySection();