π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix gallery sliver app bar states
ashilknefb23883e5e1
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dartindex ec26e1d47f..bec4a5c3df 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart@@ -38,21 +38,15 @@ class ArchivePage extends StatelessWidget {Widget build(BuildContext context) {final Set<int> hiddenCollectionIDs = CollectionsService.instance.getHiddenCollectionIds();+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ appBarType,+ AppLocalizations.of(context).archive,+ _selectedFiles,+ isHierarchicalSearchable: false,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).archive,- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return FilesDB.instance.getAllPendingOrUploadedFiles(creationStartTime,diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dartindex 7560002bf6..c2b537489f 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/cleanup_hidden_from_device_page.dart@@ -60,22 +60,16 @@ class _CleanupHiddenFromDevicePageStatefinal filesAreSelected = _selectedFiles.files.isNotEmpty;final bottomPadding = MediaQuery.of(context).padding.bottom;final deleteAllButtonHeight = 40.0 + max(bottomPadding, 6.0) + 12.0;+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ GalleryType.cleanupHiddenFromDevice,+ AppLocalizations.of(context).deleteOnDeviceFiles,+ _selectedFiles,+ isHierarchicalSearchable: false,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- GalleryType.cleanupHiddenFromDevice,- AppLocalizations.of(context).deleteOnDeviceFiles,- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final files = await CollectionsService.instance.getHiddenFilesOnDevice();diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dartindex c420099074..b9fe2e1e20 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart@@ -58,23 +58,17 @@ class CollectionPage extends StatelessWidget {final List<EnteFile>? initialFiles = c.thumbnail != null? [c.thumbnail!]: null;+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ galleryType,+ c.collection.displayName,+ _selectedFiles,+ isHierarchicalSearchable: true,+ collection: c.collection,+ isFromCollectPhotos: isFromCollectPhotos,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- galleryType,- c.collection.displayName,- _selectedFiles,- collection: c.collection,- isFromCollectPhotos: isFromCollectPhotos,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: true,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: true,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final FileLoadResult result = await FilesDB.instance.getFilesInCollection(@@ -169,6 +163,7 @@ class CollectionPage extends StatelessWidget {? HierarchicalSearchGallery(tagPrefix: tagPrefix,selectedFiles: _selectedFiles,+ appBar: appBar,): gallery;},diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dartindex 23e680ef08..4b5794ab4d 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/delete_suggestions_page.dart@@ -29,21 +29,15 @@ class DeleteSuggestionsPage extends StatelessWidget {@overrideWidget build(BuildContext context) {+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ appBarType,+ AppLocalizations.of(context).deleteSuggestions,+ _selectedFiles,+ isHierarchicalSearchable: false,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).deleteSuggestions,- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final fileIDs = await CollectionsService.instance.fetchDeleteSuggestionFileIDs();diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/device_folder_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/device_folder_page.dartindex 6922ef6991..996ad6b640 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/device_folder_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/device_folder_page.dart@@ -36,22 +36,16 @@ class DeviceFolderPage extends StatelessWidget {@overrideWidget build(BuildContext context) {final int? userID = Configuration.instance.getUserID();+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ GalleryType.localFolder,+ deviceCollection.name,+ _selectedFiles,+ isHierarchicalSearchable: false,+ deviceCollection: deviceCollection,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- GalleryType.localFolder,- deviceCollection.name,- _selectedFiles,- deviceCollection: deviceCollection,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return FilesDB.instance.getFilesInDeviceCollection(deviceCollection,diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dartindex ab1be826d9..62fdd92785 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart@@ -28,6 +28,7 @@ import "package:photos/ui/viewer/gallery/component/group/group_header_widget.darimport "package:photos/ui/viewer/gallery/component/group/type.dart";import "package:photos/ui/viewer/gallery/component/sectioned_sliver_list.dart";import 'package:photos/ui/viewer/gallery/empty_state.dart';+import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";import "package:photos/ui/viewer/gallery/scrollbar/custom_scroll_bar.dart";import "package:photos/ui/viewer/gallery/state/boundary_reporter_mixin.dart";import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.dart";@@ -58,9 +59,7 @@ class Gallery extends StatefulWidget {final Set<EventType> removalEventTypes;final SelectedFiles? selectedFiles;final String tagPrefix;- final Widget? appBarSliver;- final double appBarPinnedHeight;- final double appBarExpandedHeight;+ final GalleryAppBarConfig? appBar;final Widget? header;final Widget? footer;final Widget emptyState;@@ -103,9 +102,7 @@ class Gallery extends StatefulWidget {const Gallery({required this.asyncLoader,required this.tagPrefix,- this.appBarSliver,- this.appBarPinnedHeight = 0,- this.appBarExpandedHeight = 0,+ this.appBar,this.selectedFiles,this.initialFiles,this.reloadEvent,@@ -604,6 +601,29 @@ class GalleryState extends State<Gallery> {super.dispose();}+ double get _appBarPinnedHeight => widget.appBar?.pinnedHeight ?? 0;++ double get _appBarCollapseExtent => widget.appBar?.collapseExtent ?? 0;++ ScrollPhysics get _scrollPhysics => widget.disableScroll+ ? const NeverScrollableScrollPhysics()+ : const ExponentialBouncingScrollPhysics();++ Widget _buildWithAppBar(BuildContext context, Widget child) {+ final appBar = widget.appBar;+ if (appBar == null) {+ return child;+ }++ return CustomScrollView(+ physics: _scrollPhysics,+ slivers: [+ appBar.buildSliver(context),+ SliverFillRemaining(hasScrollBody: false, child: child),+ ],+ );+ }+@overrideWidget build(BuildContext context) {_logger.info("Building Gallery ${widget.tagPrefix}");@@ -652,7 +672,8 @@ class GalleryState extends State<Gallery> {final tileHeight =(widthAvailable - (photoGridSize - 1) * GalleryGroups.spacing) /photoGridSize;- return widget.initialFiles != null && widget.initialFiles!.isNotEmpty+ final placeholder =+ widget.initialFiles != null && widget.initialFiles!.isNotEmpty? Column(mainAxisAlignment: MainAxisAlignment.start,children: [@@ -682,11 +703,12 @@ class GalleryState extends State<Gallery> {],): const SizedBox.shrink();+ return _buildWithAppBar(context, placeholder);}GalleryFilesState.of(context).setGalleryFiles = _allGalleryFiles;if (!_hasLoadedFiles) {- return widget.loadingWidget;+ return _buildWithAppBar(context, widget.loadingWidget);}if (galleryGroups == null) {@@ -694,7 +716,7 @@ class GalleryState extends State<Gallery> {}final groups = galleryGroups;if (groups == null) {- return widget.loadingWidget;+ return _buildWithAppBar(context, widget.loadingWidget);}// Check if width changed due to orientation change and update gallery groups@@ -705,12 +727,12 @@ class GalleryState extends State<Gallery> {}});}- if (widget.appBarPinnedHeight > 0 &&+ if (_appBarPinnedHeight > 0 &&(!groups.groupType.showGroupHeader() ||widget.disablePinnedGroupHeader)) {WidgetsBinding.instance.addPostFrameCallback((_) {if (mounted) {- _boundariesProvider?.setTopBoundary(widget.appBarPinnedHeight);+ _boundariesProvider?.setTopBoundary(_appBarPinnedHeight);}});}@@ -736,7 +758,7 @@ class GalleryState extends State<Gallery> {heighOfViewport: MediaQuery.sizeOf(context).height,topPadding: widget.disableVerticalPaddingForScrollbar? 0.0- : widget.appBarPinnedHeight + groupHeaderExtent!,+ : _appBarPinnedHeight + groupHeaderExtent!,bottomPadding: widget.disableVerticalPaddingForScrollbar? ValueNotifier(0.0): scrollbarBottomPaddingNotifier,@@ -769,8 +791,8 @@ class GalleryState extends State<Gallery> {: const ExponentialBouncingScrollPhysics(),controller: _scrollController,slivers: [- if (widget.appBarSliver != null)- widget.appBarSliver!,+ if (widget.appBar != null)+ widget.appBar!.buildSliver(context),SliverToBoxAdapter(child: SizeChangedLayoutNotifier(child: SizedBox(@@ -795,13 +817,8 @@ class GalleryState extends State<Gallery> {scrollController: _scrollController,galleryGroups: groups,headerHeightNotifier: _headerHeightNotifier,- scrollOffsetBase:- widget.appBarExpandedHeight >- widget.appBarPinnedHeight- ? widget.appBarExpandedHeight -- widget.appBarPinnedHeight- : 0,- topOffset: widget.appBarPinnedHeight,+ scrollOffsetBase: _appBarCollapseExtent,+ topOffset: _appBarPinnedHeight,selectedFiles: widget.selectedFiles,showSelectAll:widget.showSelectAll &&@@ -832,20 +849,7 @@ class GalleryState extends State<Gallery> {],);- if (widget.appBarSliver == null) {- return emptyColumn;- }-- return CustomScrollView(- controller: _scrollController,- physics: widget.disableScroll- ? const NeverScrollableScrollPhysics()- : const ExponentialBouncingScrollPhysics(),- slivers: [- widget.appBarSliver!,- SliverFillRemaining(hasScrollBody: false, child: emptyColumn),- ],- );+ return _buildWithAppBar(context, emptyColumn);}}@@ -885,6 +889,7 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>String? currentGroupId;final _enlargeHeader = ValueNotifier<bool>(false);Timer? _enlargeHeaderTimer;+ InheritedGalleryBoundaries? _boundariesProvider;late final ValueNotifier<bool> _atZeroScrollNotifier;Timer? _timer;bool lastInUseState = false;@@ -894,9 +899,12 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>super.initState();widget.scrollbarInUseNotifier.addListener(scrollbarInUseListener);widget.scrollController.addListener(_setCurrentGroupID);- _atZeroScrollNotifier = ValueNotifier<bool>(- widget.scrollController.offset == 0,- );+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted) {+ _setBaseTopBoundary();+ }+ });+ _atZeroScrollNotifier = ValueNotifier<bool>((_scrollOffset ?? 0) == 0);widget.scrollController.addListener(_scrollControllerListenerForZeroScrollNotifier,);@@ -909,6 +917,12 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>_setCurrentGroupID();}+ @override+ void didChangeDependencies() {+ super.didChangeDependencies();+ _boundariesProvider = GalleryBoundariesProvider.of(context);+ }+@overridevoid dispose() {widget.scrollController.removeListener(_setCurrentGroupID);@@ -926,17 +940,17 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>void _setCurrentGroupID() {if (widget.headerHeightNotifier.value == null) return;+ final scrollOffset = _scrollOffset;+ if (scrollOffset == null) return;final normalizedScrollOffset =- widget.scrollController.offset -+ scrollOffset -widget.scrollOffsetBase -widget.headerHeightNotifier.value!;if (normalizedScrollOffset < 0) {+ _setBaseTopBoundary();// No change in group ID, no need to call setStateif (currentGroupId == null) return;currentGroupId = null;- GalleryBoundariesProvider.of(- context,- )?.setTopBoundary(widget.topOffset > 0 ? widget.topOffset : null);} else {final groupScrollOffsets = widget.galleryGroups.groupScrollOffsets;@@ -990,8 +1004,23 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>}}+ void _setBaseTopBoundary() {+ _boundariesProvider?.setTopBoundary(+ widget.topOffset > 0 ? widget.topOffset : null,+ );+ }+void _scrollControllerListenerForZeroScrollNotifier() {- _atZeroScrollNotifier.value = widget.scrollController.offset == 0;+ final scrollOffset = _scrollOffset;+ if (scrollOffset == null) return;+ _atZeroScrollNotifier.value = scrollOffset == 0;+ }++ double? get _scrollOffset {+ if (widget.scrollController.positions.length != 1) {+ return null;+ }+ return widget.scrollController.offset;}void scrollbarInUseListener() {diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_config.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_config.dartnew file mode 100644index 0000000000..824e343fb0--- /dev/null+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_config.dart@@ -0,0 +1,17 @@+import "package:flutter/widgets.dart";++class GalleryAppBarConfig {+ const GalleryAppBarConfig({+ required this.sliverBuilder,+ required this.pinnedHeight,+ required this.expandedHeight,+ }) : assert(expandedHeight >= pinnedHeight);++ final WidgetBuilder sliverBuilder;+ final double pinnedHeight;+ final double expandedHeight;++ double get collapseExtent => expandedHeight - pinnedHeight;++ Widget buildSliver(BuildContext context) => sliverBuilder(context);+}diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dartindex 4aa10e3d3b..633831fc85 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart@@ -50,6 +50,7 @@ import "package:photos/ui/sharing/manage_links_widget.dart";import 'package:photos/ui/sharing/share_collection_page.dart';import 'package:photos/ui/tools/free_space_page.dart';import "package:photos/ui/viewer/file/detail_page.dart";+import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";import 'package:photos/ui/viewer/gallery/hooks/pick_cover_photo.dart';import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";@@ -93,6 +94,39 @@ class GalleryAppBarWidget extends StatefulWidget {: 0);}+ static GalleryAppBarConfig sliverConfig(+ BuildContext context,+ GalleryType type,+ String? title,+ SelectedFiles selectedFiles, {+ required bool isHierarchicalSearchable,+ DeviceCollection? deviceCollection,+ Collection? collection,+ bool isFromCollectPhotos = false,+ List<EnteFile>? files,+ }) {+ return GalleryAppBarConfig(+ sliverBuilder: (_) => GalleryAppBarWidget(+ type,+ title,+ selectedFiles,+ deviceCollection: deviceCollection,+ collection: collection,+ isFromCollectPhotos: isFromCollectPhotos,+ files: files,+ asSliver: true,+ ),+ pinnedHeight: sliverPinnedHeight(+ context,+ isHierarchicalSearchable: isHierarchicalSearchable,+ ),+ expandedHeight: sliverExpandedHeight(+ context,+ isHierarchicalSearchable: isHierarchicalSearchable,+ ),+ );+ }+final GalleryType type;final String? title;final SelectedFiles selectedFiles;diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dartindex 4d69334e78..38800583b8 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart@@ -169,21 +169,15 @@ class _HiddenPageState extends State<HiddenPage> {if (_defaultHiddenCollectionId == null) {return const EnteLoadingWidget();}+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ widget.appBarType,+ AppLocalizations.of(context).hidden,+ _selectedFiles,+ isHierarchicalSearchable: false,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- widget.appBarType,- AppLocalizations.of(context).hidden,- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return FilesDB.instance.getFilesInCollections([_defaultHiddenCollectionId!],diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dartindex bbc02430b2..59455784b5 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hierarchical_search_gallery.dart@@ -17,6 +17,7 @@ import "package:photos/services/machine_learning/face_ml/feedback/cluster_feedbaimport "package:photos/services/machine_learning/face_ml/person/person_service.dart";import "package:photos/ui/common/loading_widget.dart";import "package:photos/ui/viewer/gallery/gallery.dart";+import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";@@ -30,9 +31,11 @@ import "package:photos/utils/hierarchical_search_util.dart";class HierarchicalSearchGallery extends StatefulWidget {final String tagPrefix;final SelectedFiles? selectedFiles;+ final GalleryAppBarConfig? appBar;const HierarchicalSearchGallery({required this.tagPrefix,this.selectedFiles,+ this.appBar,super.key,});@@ -204,9 +207,10 @@ class _HierarchicalSearchGalleryState extends State<HierarchicalSearchGallery> {switchInCurve: Curves.easeInOutExpo,switchOutCurve: Curves.easeInOutExpo,child: isLoading- ? const EnteLoadingWidget()+ ? _buildLoadingState(context): Gallery(key: ValueKey(_filteredFilesVersion),+ appBar: widget.appBar,asyncLoader:(creationStartTime, creationEndTime, {limit, asc}) async {final files = _filterdFiles@@ -266,4 +270,21 @@ class _HierarchicalSearchGalleryState extends State<HierarchicalSearchGallery> {},);}++ Widget _buildLoadingState(BuildContext context) {+ final appBar = widget.appBar;+ if (appBar == null) {+ return const EnteLoadingWidget();+ }++ return CustomScrollView(+ slivers: [+ appBar.buildSliver(context),+ const SliverFillRemaining(+ hasScrollBody: false,+ child: EnteLoadingWidget(),+ ),+ ],+ );+ }}diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dartindex 1ad3b8bec2..57dc000544 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dart@@ -116,12 +116,27 @@ class _JumpToDateGalleryState extends State<JumpToDateGallery> {@overrideWidget build(BuildContext context) {+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ JumpToDateGallery.appBarType,+ "",+ _selectedFiles,+ isHierarchicalSearchable: false,+ );return GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(body: _loadState == GalleryLoadState.loadingFiles- ? EnteLoadingWidget(- color: getEnteColorScheme(context).strokeMuted,+ ? CustomScrollView(+ slivers: [+ appBar.buildSliver(context),+ SliverFillRemaining(+ hasScrollBody: false,+ child: EnteLoadingWidget(+ color: getEnteColorScheme(context).strokeMuted,+ ),+ ),+ ],): AnimatedOpacity(opacity: _loadState == GalleryLoadState.galleryReady@@ -135,22 +150,7 @@ class _JumpToDateGalleryState extends State<JumpToDateGallery> {alignment: Alignment.bottomCenter,children: [Gallery(- appBarSliver: GalleryAppBarWidget(- JumpToDateGallery.appBarType,- "",- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight:- GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight:- GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader:(creationStartTime,diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dartindex 82bf2638a2..e0cb293d20 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/shared_public_collection_page.dart@@ -126,24 +126,18 @@ class _SharedPublicCollectionPageStatefinal GroupType groupType = normalizedLayout == "masonry"? GroupType.none: GroupType.day;+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ galleryType,+ widget.c.collection.displayName,+ _selectedFiles,+ isHierarchicalSearchable: false,+ collection: widget.c.collection,+ files: widget.files,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- galleryType,- widget.c.collection.displayName,- _selectedFiles,- collection: widget.c.collection,- files: widget.files,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {widget.files!.sort((a, b) => b.creationTime!.compareTo(a.creationTime!),diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dartindex 8151334120..6141740f24 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart@@ -36,22 +36,16 @@ class TrashPage extends StatelessWidget {final bool filesAreSelected = _selectedFiles.files.isNotEmpty;final bottomPadding = MediaQuery.of(context).padding.bottom;final deleteAllButtonHeight = 40.0 + max(bottomPadding, 6.0) + 12.0;+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ appBarType,+ AppLocalizations.of(context).trash,+ _selectedFiles,+ isHierarchicalSearchable: false,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).trash,- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: false,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: false,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return TrashDB.instance.getTrashedFiles(creationStartTime,diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dartindex d4dd44ff43..7d04e9c7ca 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart@@ -39,22 +39,16 @@ class UnCategorizedPage extends StatelessWidget {@overrideWidget build(BuildContext context) {+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ appBarType,+ AppLocalizations.of(context).uncategorized,+ _selectedFiles,+ isHierarchicalSearchable: true,+ collection: collection,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).uncategorized,- _selectedFiles,- collection: collection,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: true,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: true,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final FileLoadResult result = await FilesDB.instance.getFilesInCollection(@@ -122,6 +116,7 @@ class UnCategorizedPage extends StatelessWidget {? HierarchicalSearchGallery(tagPrefix: tagPrefix,selectedFiles: _selectedFiles,+ appBar: appBar,): gallery;},diff --git a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dartindex 42b8cc57b5..58822794c6 100644--- a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart+++ b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart@@ -142,6 +142,13 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {final centerPoint = InheritedLocationScreenState.of(context,).locationTagEntity.item.centerPoint;+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ GalleryType.locationTag,+ locationTag.name,+ _selectedFiles,+ isHierarchicalSearchable: true,+ );Future<FileLoadResult> filterFiles() async {//waiting for allFilesWithLocation to be initialized@@ -186,24 +193,10 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {? HierarchicalSearchGallery(tagPrefix: widget.tagPrefix,selectedFiles: _selectedFiles,+ appBar: appBar,): Gallery(- appBarSliver: GalleryAppBarWidget(- GalleryType.locationTag,- locationTag.name,- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight:- GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: true,- ),- appBarExpandedHeight:- GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: true,- ),+ appBar: appBar,loadingWidget: Column(children: [EnteLoadingWidget(@@ -243,7 +236,15 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {),);} else {- return const Column(children: [Expanded(child: EnteLoadingWidget())]);+ return CustomScrollView(+ slivers: [+ appBar.buildSliver(context),+ const SliverFillRemaining(+ hasScrollBody: false,+ child: EnteLoadingWidget(),+ ),+ ],+ );}},future: filterFiles(),diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart b/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dartindex fad2e3b760..f84c979417 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart@@ -177,22 +177,16 @@ class _MagicResultScreenState extends State<MagicResultScreen> {@overrideWidget build(BuildContext context) {+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ MagicResultScreen.appBarType,+ widget.name,+ _selectedFiles,+ isHierarchicalSearchable: true,+ );final gallery = Gallery(key: ValueKey(_enableGrouping),- appBarSliver: GalleryAppBarWidget(- MagicResultScreen.appBarType,- widget.name,- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: true,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: true,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {final result = files.where(@@ -237,6 +231,7 @@ class _MagicResultScreenState extends State<MagicResultScreen> {? HierarchicalSearchGallery(tagPrefix: widget.heroTag,selectedFiles: _selectedFiles,+ appBar: appBar,): AnimatedSwitcher(duration: const Duration(milliseconds: 250),diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dartindex c86a220be8..437a542de0 100644--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart@@ -74,21 +74,15 @@ class _SearchResultPageState extends State<SearchResultPage> {@overrideWidget build(BuildContext context) {+ final appBar = GalleryAppBarWidget.sliverConfig(+ context,+ SearchResultPage.appBarType,+ widget.searchResult.name(),+ _selectedFiles,+ isHierarchicalSearchable: true,+ );final gallery = Gallery(- appBarSliver: GalleryAppBarWidget(- SearchResultPage.appBarType,- widget.searchResult.name(),- _selectedFiles,- asSliver: true,- ),- appBarPinnedHeight: GalleryAppBarWidget.sliverPinnedHeight(- context,- isHierarchicalSearchable: true,- ),- appBarExpandedHeight: GalleryAppBarWidget.sliverExpandedHeight(- context,- isHierarchicalSearchable: true,- ),+ appBar: appBar,asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {final result = files.where(@@ -136,6 +130,7 @@ class _SearchResultPageState extends State<SearchResultPage> {? HierarchicalSearchGallery(tagPrefix: widget.tagPrefix,selectedFiles: _selectedFiles,+ appBar: appBar,): gallery;},