π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Use shared sliver app bar for gallery pages
ashilkna2af58b2f23d
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dartindex 8c46bae0c1..ec26e1d47f 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart@@ -39,6 +39,20 @@ class ArchivePage extends StatelessWidget {final Set<int> hiddenCollectionIDs = CollectionsService.instance.getHiddenCollectionIds();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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return FilesDB.instance.getAllPendingOrUploadedFiles(creationStartTime,@@ -102,16 +116,6 @@ class ArchivePage extends StatelessWidget {return GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).archive,- _selectedFiles,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(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 6a34f2b3b1..7560002bf6 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@@ -62,6 +62,20 @@ class _CleanupHiddenFromDevicePageStatefinal deleteAllButtonHeight = 40.0 + max(bottomPadding, 6.0) + 12.0;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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final files = await CollectionsService.instance.getHiddenFilesOnDevice();@@ -80,16 +94,6 @@ class _CleanupHiddenFromDevicePageStatereturn GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- GalleryType.cleanupHiddenFromDevice,- AppLocalizations.of(context).deleteOnDeviceFiles,- _selectedFiles,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dartindex 07441aaef8..c420099074 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart@@ -59,6 +59,22 @@ class CollectionPage extends StatelessWidget {? [c.thumbnail!]: null;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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final FileLoadResult result = await FilesDB.instance.getFilesInCollection(@@ -131,18 +147,6 @@ class CollectionPage extends StatelessWidget {),child: GalleryBoundariesProvider(child: Scaffold(- appBar: PreferredSize(- preferredSize: Size.fromHeight(- GalleryAppBarWidget.hierarchicalPreferredHeight(context),- ),- child: GalleryAppBarWidget(- galleryType,- c.collection.displayName,- _selectedFiles,- collection: c.collection,- isFromCollectPhotos: isFromCollectPhotos,- ),- ),bottomNavigationBar: isFromCollectPhotos? CollectPhotosBottomButtons(c.collection,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 ee20956343..23e680ef08 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@@ -30,6 +30,20 @@ class DeleteSuggestionsPage extends StatelessWidget {@overrideWidget build(BuildContext context) {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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final fileIDs = await CollectionsService.instance.fetchDeleteSuggestionFileIDs();@@ -52,16 +66,6 @@ class DeleteSuggestionsPage extends StatelessWidget {return GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).deleteSuggestions,- _selectedFiles,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(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 d8d834f0f9..6922ef6991 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@@ -34,9 +34,24 @@ class DeviceFolderPage extends StatelessWidget {DeviceFolderPage(this.deviceCollection, {super.key});@override- Widget build(Object context) {+ Widget build(BuildContext context) {final int? userID = Configuration.instance.getUserID();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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return FilesDB.instance.getFilesInDeviceCollection(deviceCollection,@@ -66,17 +81,6 @@ class DeviceFolderPage extends StatelessWidget {return GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- GalleryType.localFolder,- deviceCollection.name,- _selectedFiles,- deviceCollection: deviceCollection,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dartindex 5bfecded9f..ab1be826d9 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart@@ -58,6 +58,9 @@ class Gallery extends StatefulWidget {final Set<EventType> removalEventTypes;final SelectedFiles? selectedFiles;final String tagPrefix;+ final Widget? appBarSliver;+ final double appBarPinnedHeight;+ final double appBarExpandedHeight;final Widget? header;final Widget? footer;final Widget emptyState;@@ -100,6 +103,9 @@ class Gallery extends StatefulWidget {const Gallery({required this.asyncLoader,required this.tagPrefix,+ this.appBarSliver,+ this.appBarPinnedHeight = 0,+ this.appBarExpandedHeight = 0,this.selectedFiles,this.initialFiles,this.reloadEvent,@@ -699,6 +705,16 @@ class GalleryState extends State<Gallery> {}});}+ if (widget.appBarPinnedHeight > 0 &&+ (!groups.groupType.showGroupHeader() ||+ widget.disablePinnedGroupHeader)) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted) {+ _boundariesProvider?.setTopBoundary(widget.appBarPinnedHeight);+ }+ });+ }+ final scrollContentMediaQuery = MediaQuery.of(context);return SwipeSelectionWrapper(isEnabled: shouldEnableSwipeSelection,@@ -712,16 +728,7 @@ class GalleryState extends State<Gallery> {type: _groupType,galleryType: widget.galleryType,child: _allGalleryFiles.isEmpty- ? Column(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- if (widget.addHeaderOrFooterEmptyState)- widget.header ?? const SizedBox.shrink(),- Expanded(child: widget.emptyState),- if (widget.addHeaderOrFooterEmptyState)- widget.footer ?? const SizedBox.shrink(),- ],- )+ ? _buildEmptyGalleryContent(): CustomScrollBar(scrollController: _scrollController,galleryGroups: groups,@@ -729,7 +736,7 @@ class GalleryState extends State<Gallery> {heighOfViewport: MediaQuery.sizeOf(context).height,topPadding: widget.disableVerticalPaddingForScrollbar? 0.0- : groupHeaderExtent!,+ : widget.appBarPinnedHeight + groupHeaderExtent!,bottomPadding: widget.disableVerticalPaddingForScrollbar? ValueNotifier(0.0): scrollbarBottomPaddingNotifier,@@ -748,64 +755,106 @@ class GalleryState extends State<Gallery> {return true;},- child: Stack(- clipBehavior: Clip.none,- children: [- ValueListenableBuilder<bool>(- valueListenable: _swipeActiveNotifier,- builder: (context, isSwipeActive, child) {- return CustomScrollView(- physics: widget.disableScroll || isSwipeActive- ? const NeverScrollableScrollPhysics()- : const ExponentialBouncingScrollPhysics(),- controller: _scrollController,- slivers: [- SliverToBoxAdapter(- child: SizeChangedLayoutNotifier(- child: SizedBox(- key: _headerKey,- child:- widget.header ??- const SizedBox.shrink(),+ child: MediaQuery(+ data: scrollContentMediaQuery,+ child: Stack(+ clipBehavior: Clip.none,+ children: [+ ValueListenableBuilder<bool>(+ valueListenable: _swipeActiveNotifier,+ builder: (context, isSwipeActive, child) {+ return CustomScrollView(+ physics: widget.disableScroll || isSwipeActive+ ? const NeverScrollableScrollPhysics()+ : const ExponentialBouncingScrollPhysics(),+ controller: _scrollController,+ slivers: [+ if (widget.appBarSliver != null)+ widget.appBarSliver!,+ SliverToBoxAdapter(+ child: SizeChangedLayoutNotifier(+ child: SizedBox(+ key: _headerKey,+ child:+ widget.header ??+ const SizedBox.shrink(),+ ),),),- ),- SectionedListSliver(- sectionLayouts: groups.groupLayouts,- ),- SliverToBoxAdapter(child: widget.footer),- ],- );- },- ),- groups.groupType.showGroupHeader() &&- !widget.disablePinnedGroupHeader- ? PinnedGroupHeader(- scrollController: _scrollController,- galleryGroups: groups,- headerHeightNotifier: _headerHeightNotifier,- selectedFiles: widget.selectedFiles,- showSelectAll:- widget.showSelectAll &&- !widget.limitSelectionToOne,- scrollbarInUseNotifier: scrollBarInUseNotifier,- showGallerySettingsCTA:- widget.showGallerySettingsCTA,- )- : const SizedBox.shrink(),- ],+ SectionedListSliver(+ sectionLayouts: groups.groupLayouts,+ ),+ SliverToBoxAdapter(child: widget.footer),+ ],+ );+ },+ ),+ groups.groupType.showGroupHeader() &&+ !widget.disablePinnedGroupHeader+ ? PinnedGroupHeader(+ scrollController: _scrollController,+ galleryGroups: groups,+ headerHeightNotifier: _headerHeightNotifier,+ scrollOffsetBase:+ widget.appBarExpandedHeight >+ widget.appBarPinnedHeight+ ? widget.appBarExpandedHeight -+ widget.appBarPinnedHeight+ : 0,+ topOffset: widget.appBarPinnedHeight,+ selectedFiles: widget.selectedFiles,+ showSelectAll:+ widget.showSelectAll &&+ !widget.limitSelectionToOne,+ scrollbarInUseNotifier: scrollBarInUseNotifier,+ showGallerySettingsCTA:+ widget.showGallerySettingsCTA,+ )+ : const SizedBox.shrink(),+ ],+ ),),),),),);}++ Widget _buildEmptyGalleryContent() {+ final emptyColumn = Column(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ if (widget.addHeaderOrFooterEmptyState)+ widget.header ?? const SizedBox.shrink(),+ Expanded(child: widget.emptyState),+ if (widget.addHeaderOrFooterEmptyState)+ widget.footer ?? const SizedBox.shrink(),+ ],+ );++ 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),+ ],+ );+ }}class PinnedGroupHeader extends StatefulWidget {final ScrollController scrollController;final GalleryGroups galleryGroups;final ValueNotifier<double?> headerHeightNotifier;+ final double scrollOffsetBase;+ final double topOffset;final SelectedFiles? selectedFiles;final bool showSelectAll;final ValueNotifier<bool> scrollbarInUseNotifier;@@ -818,6 +867,8 @@ class PinnedGroupHeader extends StatefulWidget {required this.scrollController,required this.galleryGroups,required this.headerHeightNotifier,+ required this.scrollOffsetBase,+ required this.topOffset,required this.selectedFiles,required this.showSelectAll,required this.scrollbarInUseNotifier,@@ -876,11 +927,16 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>void _setCurrentGroupID() {if (widget.headerHeightNotifier.value == null) return;final normalizedScrollOffset =- widget.scrollController.offset - widget.headerHeightNotifier.value!;+ widget.scrollController.offset -+ widget.scrollOffsetBase -+ widget.headerHeightNotifier.value!;if (normalizedScrollOffset < 0) {// 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;@@ -978,7 +1034,7 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>@overrideWidget build(BuildContext context) {- return currentGroupId != null+ final header = currentGroupId != null? ValueListenableBuilder(valueListenable: _enlargeHeader,builder: (context, inUse, _) {@@ -1045,6 +1101,15 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>},): const SizedBox.shrink();++ if (widget.topOffset == 0) {+ return header;+ }++ return Padding(+ padding: EdgeInsets.only(top: widget.topOffset),+ child: header,+ );}}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 73a142de4a..4aa10e3d3b 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@@ -65,11 +65,34 @@ class GalleryAppBarWidget extends StatefulWidget {static const double _controlRowHeight = 38.0;static const double _actionGap = 8.0;static const double _defaultBackIconSize = IconSizes.medium;+ static const double _sliverExpandedHeight = 92.0;static double hierarchicalPreferredHeight(BuildContext context) {return toolbarHeight + AppBarFilterChips.preferredHeight(context);}+ static double sliverPinnedHeight(+ BuildContext context, {+ required bool isHierarchicalSearchable,+ }) {+ return MediaQuery.paddingOf(context).top ++ toolbarHeight ++ (isHierarchicalSearchable+ ? AppBarFilterChips.preferredHeight(context)+ : 0);+ }++ static double sliverExpandedHeight(+ BuildContext context, {+ required bool isHierarchicalSearchable,+ }) {+ return MediaQuery.paddingOf(context).top ++ _sliverExpandedHeight ++ (isHierarchicalSearchable+ ? AppBarFilterChips.preferredHeight(context)+ : 0);+ }+final GalleryType type;final String? title;final SelectedFiles selectedFiles;@@ -77,6 +100,7 @@ class GalleryAppBarWidget extends StatefulWidget {final Collection? collection;final bool isFromCollectPhotos;final List<EnteFile>? files;+ final bool asSliver;const GalleryAppBarWidget(this.type,@@ -87,6 +111,7 @@ class GalleryAppBarWidget extends StatefulWidget {this.collection,this.isFromCollectPhotos = false,this.files,+ this.asSliver = false,});@override@@ -194,9 +219,13 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {final isHierarchicalSearchable =inheritedSearchFilterData?.isHierarchicalSearchable ?? false;- return galleryType == GalleryType.homepage- ? const SizedBox.shrink()- : isHierarchicalSearchable+ if (galleryType == GalleryType.homepage) {+ return widget.asSliver+ ? const SliverToBoxAdapter(child: SizedBox.shrink())+ : const SizedBox.shrink();+ }++ return isHierarchicalSearchable? ValueListenableBuilder(valueListenable: inheritedSearchFilterData!.searchFilterDataProvider!@@ -208,16 +237,43 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {child: const AppBarFilterChips(),),builder: (context, isSearching, child) {- return _buildAppBar(- context,- actions: isSearching ? const [] : _getDefaultActions(context),- bottom: child as PreferredSizeWidget,- );+ return widget.asSliver+ ? _buildSliverAppBar(+ context,+ actions: isSearching+ ? const []+ : _getDefaultActions(context),+ bottom: child as PreferredSizeWidget,+ )+ : _buildAppBar(+ context,+ actions: isSearching+ ? const []+ : _getDefaultActions(context),+ bottom: child as PreferredSizeWidget,+ );},)+ : widget.asSliver+ ? _buildSliverAppBar(context, actions: _getDefaultActions(context)): _buildAppBar(context, actions: _getDefaultActions(context));}+ Widget _buildSliverAppBar(+ BuildContext context, {+ required List<Widget> actions,+ PreferredSizeWidget? bottom,+ }) {+ return SliverAppBarComponent(+ title: _appBarTitle!,+ actions: actions,+ bottom: bottom,+ expandedHeight: GalleryAppBarWidget._sliverExpandedHeight,+ collapsedHeight: GalleryAppBarWidget.toolbarHeight,+ backgroundColor: getEnteColorScheme(context).backgroundColour,+ );+ }+AppBar _buildAppBar(BuildContext context, {required List<Widget> actions,diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dartindex a4953995bd..4d69334e78 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart@@ -170,6 +170,20 @@ class _HiddenPageState extends State<HiddenPage> {return const EnteLoadingWidget();}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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return FilesDB.instance.getFilesInCollections([_defaultHiddenCollectionId!],@@ -262,16 +276,6 @@ class _HiddenPageState extends State<HiddenPage> {return GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- widget.appBarType,- AppLocalizations.of(context).hidden,- _selectedFiles,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(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 786cf3f600..1ad3b8bec2 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@@ -119,16 +119,6 @@ class _JumpToDateGalleryState extends State<JumpToDateGallery> {return GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- JumpToDateGallery.appBarType,- "",- _selectedFiles,- ),- ),body: _loadState == GalleryLoadState.loadingFiles? EnteLoadingWidget(color: getEnteColorScheme(context).strokeMuted,@@ -145,6 +135,22 @@ 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,+ ),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 5e680d2018..82bf2638a2 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@@ -128,6 +128,22 @@ class _SharedPublicCollectionPageState: GroupType.day;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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {widget.files!.sort((a, b) => b.creationTime!.compareTo(a.creationTime!),@@ -184,18 +200,6 @@ class _SharedPublicCollectionPageStatereturn GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- galleryType,- widget.c.collection.displayName,- _selectedFiles,- collection: widget.c.collection,- files: widget.files,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dartindex 9c8f00312d..8151334120 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart@@ -38,6 +38,20 @@ class TrashPage extends StatelessWidget {final deleteAllButtonHeight = 40.0 + max(bottomPadding, 6.0) + 12.0;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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {return TrashDB.instance.getTrashedFiles(creationStartTime,@@ -63,16 +77,6 @@ class TrashPage extends StatelessWidget {return GalleryBoundariesProvider(child: GalleryFilesState(child: Scaffold(- appBar: PreferredSize(- preferredSize: const Size.fromHeight(- GalleryAppBarWidget.toolbarHeight,- ),- child: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).trash,- _selectedFiles,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dartindex c788a5b264..d4dd44ff43 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart@@ -40,6 +40,21 @@ class UnCategorizedPage extends StatelessWidget {@overrideWidget build(BuildContext context) {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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {final FileLoadResult result = await FilesDB.instance.getFilesInCollection(@@ -91,17 +106,6 @@ class UnCategorizedPage extends StatelessWidget {),),child: Scaffold(- appBar: PreferredSize(- preferredSize: Size.fromHeight(- GalleryAppBarWidget.hierarchicalPreferredHeight(context),- ),- child: GalleryAppBarWidget(- appBarType,- AppLocalizations.of(context).uncategorized,- _selectedFiles,- collection: collection,- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(diff --git a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dartindex fca13d1cee..42b8cc57b5 100644--- a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart+++ b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart@@ -42,10 +42,6 @@ class _LocationScreenState extends State<LocationScreen> {@overrideWidget build(BuildContext context) {- final heightOfStatusBar = MediaQuery.of(context).viewPadding.top;- final heightOfAppBar = GalleryAppBarWidget.hierarchicalPreferredHeight(- context,- );final locationTag = InheritedLocationScreenState.of(context,).locationTagEntity.item;@@ -60,27 +56,9 @@ class _LocationScreenState extends State<LocationScreen> {),),child: Scaffold(- appBar: PreferredSize(- preferredSize: Size(double.infinity, heightOfAppBar),- child: GalleryAppBarWidget(- GalleryType.locationTag,- locationTag.name,- selectedFiles,- ),- ),- body: Column(- children: <Widget>[- SizedBox(- height:- MediaQuery.of(context).size.height -- (heightOfAppBar + heightOfStatusBar),- width: double.infinity,- child: LocationGalleryWidget(- tagPrefix: widget.tagPrefix,- selectedFiles: selectedFiles,- ),- ),- ],+ body: LocationGalleryWidget(+ tagPrefix: widget.tagPrefix,+ selectedFiles: selectedFiles,),),),@@ -158,6 +136,9 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {final selectedRadius = InheritedLocationScreenState.of(context,).locationTagEntity.item.radius;+ final locationTag = InheritedLocationScreenState.of(+ context,+ ).locationTagEntity.item;final centerPoint = InheritedLocationScreenState.of(context,).locationTagEntity.item.centerPoint;@@ -207,6 +188,22 @@ class _LocationGalleryWidgetState extends State<LocationGalleryWidget> {selectedFiles: _selectedFiles,): Gallery(+ appBarSliver: GalleryAppBarWidget(+ GalleryType.locationTag,+ locationTag.name,+ _selectedFiles,+ asSliver: true,+ ),+ appBarPinnedHeight:+ GalleryAppBarWidget.sliverPinnedHeight(+ context,+ isHierarchicalSearchable: true,+ ),+ appBarExpandedHeight:+ GalleryAppBarWidget.sliverExpandedHeight(+ context,+ isHierarchicalSearchable: true,+ ),loadingWidget: Column(children: [EnteLoadingWidget(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 c34fa06a66..fad2e3b760 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@@ -17,7 +17,6 @@ import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';import 'package:photos/ui/viewer/gallery/gallery.dart';import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart';import "package:photos/ui/viewer/gallery/hierarchical_search_gallery.dart";-import "package:photos/ui/viewer/gallery/state/boundary_reporter_mixin.dart";import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.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";@@ -180,6 +179,20 @@ class _MagicResultScreenState extends State<MagicResultScreen> {Widget build(BuildContext context) {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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {final result = files.where(@@ -208,24 +221,6 @@ class _MagicResultScreenState extends State<MagicResultScreen> {child: InheritedSearchFilterDataWrapper(searchFilterDataProvider: _searchFilterDataProvider,child: Scaffold(- appBar: PreferredSize(- preferredSize: Size.fromHeight(- GalleryAppBarWidget.hierarchicalPreferredHeight(context),- ),- child: _enableGrouping- ? GalleryAppBarWidget(- MagicResultScreen.appBarType,- widget.name,- _selectedFiles,- )- : _AppBarWithBoundary(- child: GalleryAppBarWidget(- MagicResultScreen.appBarType,- widget.name,- _selectedFiles,- ),- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(@@ -266,22 +261,3 @@ class _MagicResultScreenState extends State<MagicResultScreen> {);}}--/// Wrapper widget that reports the app bar as top boundary for auto-scroll-/// when file grouping is disabled-class _AppBarWithBoundary extends StatefulWidget {- final Widget child;-- const _AppBarWithBoundary({required this.child});-- @override- State<_AppBarWithBoundary> createState() => _AppBarWithBoundaryState();-}--class _AppBarWithBoundaryState extends State<_AppBarWithBoundary>- with BoundaryReporter {- @override- Widget build(BuildContext context) {- return boundaryWidget(position: BoundaryPosition.top, child: widget.child);- }-}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 6bebe46fae..c86a220be8 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@@ -13,7 +13,6 @@ import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';import 'package:photos/ui/viewer/gallery/gallery.dart';import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart';import "package:photos/ui/viewer/gallery/hierarchical_search_gallery.dart";-import "package:photos/ui/viewer/gallery/state/boundary_reporter_mixin.dart";import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.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";@@ -76,6 +75,20 @@ class _SearchResultPageState extends State<SearchResultPage> {@overrideWidget build(BuildContext context) {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,+ ),asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {final result = files.where(@@ -107,24 +120,6 @@ class _SearchResultPageState extends State<SearchResultPage> {child: InheritedSearchFilterDataWrapper(searchFilterDataProvider: _searchFilterDataProvider,child: Scaffold(- appBar: PreferredSize(- preferredSize: Size.fromHeight(- GalleryAppBarWidget.hierarchicalPreferredHeight(context),- ),- child: widget.enableGrouping- ? GalleryAppBarWidget(- SearchResultPage.appBarType,- widget.searchResult.name(),- _selectedFiles,- )- : _AppBarWithBoundary(- child: GalleryAppBarWidget(- SearchResultPage.appBarType,- widget.searchResult.name(),- _selectedFiles,- ),- ),- ),body: SelectionState(selectedFiles: _selectedFiles,child: Stack(@@ -160,22 +155,3 @@ class _SearchResultPageState extends State<SearchResultPage> {);}}--/// Wrapper widget that reports the app bar as top boundary for auto-scroll-/// when file grouping is disabled-class _AppBarWithBoundary extends StatefulWidget {- final Widget child;-- const _AppBarWithBoundary({required this.child});-- @override- State<_AppBarWithBoundary> createState() => _AppBarWithBoundaryState();-}--class _AppBarWithBoundaryState extends State<_AppBarWithBoundary>- with BoundaryReporter {- @override- Widget build(BuildContext context) {- return boundaryWidget(position: BoundaryPosition.top, child: widget.child);- }-}diff --git a/mobile/packages/ente_components/lib/components/app_bar_component.dart b/mobile/packages/ente_components/lib/components/app_bar_component.dartindex 90a5c21dd3..233b8b902f 100644--- a/mobile/packages/ente_components/lib/components/app_bar_component.dart+++ b/mobile/packages/ente_components/lib/components/app_bar_component.dart@@ -47,6 +47,7 @@ class AppBarComponent extends StatefulWidget {this.backButton,this.onBack,this.actions = const [],+ this.bottom,this.expandedHeight,this.collapsedHeight = 56,this.horizontalPadding = Spacing.lg,@@ -69,6 +70,7 @@ class AppBarComponent extends StatefulWidget {final Widget? backButton;final VoidCallback? onBack;final List<Widget> actions;+ final PreferredSizeWidget? bottom;final double? expandedHeight;final double collapsedHeight;final double horizontalPadding;@@ -240,6 +242,7 @@ class _AppBarComponentState extends State<AppBarComponent> {backButton: widget.backButton,onBack: widget.onBack,actions: widget.actions,+ bottom: widget.bottom,expandedHeight: widget.expandedHeight,collapsedHeight: widget.collapsedHeight,horizontalPadding: widget.horizontalPadding,@@ -295,6 +298,7 @@ class SliverAppBarComponent extends StatelessWidget {this.backButton,this.onBack,this.actions = const [],+ this.bottom,this.expandedHeight,this.collapsedHeight = 56,this.horizontalPadding = Spacing.lg,@@ -314,6 +318,7 @@ class SliverAppBarComponent extends StatelessWidget {final Widget? backButton;final VoidCallback? onBack;final List<Widget> actions;+ final PreferredSizeWidget? bottom;final double? expandedHeight;final double collapsedHeight;final double horizontalPadding;@@ -346,6 +351,8 @@ class SliverAppBarComponent extends StatelessWidget {backButton: backButton,onBack: onBack,actions: actions,+ bottom: bottom,+ bottomHeight: bottom?.preferredSize.height ?? 0,expandedHeight: metrics.expandedHeight,collapsedHeight: metrics.collapsedHeight,horizontalPadding: horizontalPadding,@@ -375,6 +382,8 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {required this.backButton,required this.onBack,required this.actions,+ required this.bottom,+ required this.bottomHeight,required this.expandedHeight,required this.collapsedHeight,required this.horizontalPadding,@@ -399,6 +408,8 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {final Widget? backButton;final VoidCallback? onBack;final List<Widget> actions;+ final PreferredSizeWidget? bottom;+ final double bottomHeight;final double expandedHeight;final double collapsedHeight;final double horizontalPadding;@@ -411,10 +422,10 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {final double subtitleLineHeight;@override- double get maxExtent => topPadding + expandedHeight;+ double get maxExtent => topPadding + expandedHeight + bottomHeight;@override- double get minExtent => topPadding + collapsedHeight;+ double get minExtent => topPadding + collapsedHeight + bottomHeight;@overrideWidget build(@@ -471,83 +482,101 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {return ColoredBox(color: backgroundColor ?? colors.backgroundBase,child: Padding(- padding: EdgeInsets.only(- top: topPadding,- left: horizontalPadding,- right: horizontalPadding,- ),+ padding: EdgeInsets.only(top: topPadding),child: Stack(fit: StackFit.expand,children: [- if (leading != null)- Positioned(- left: 0,- top: leadingTop,- child: IgnorePointer(- ignoring: isLeadingHidden,- child: ExcludeSemantics(- excluding: isLeadingHidden,- child: Opacity(- opacity: leadingOpacity,- child: ClipRRect(- borderRadius: BorderRadius.circular(12),- child: SizedBox.square(- dimension: _headerControlSize,- child: leading,+ Positioned.fill(+ bottom: bottomHeight,+ child: Padding(+ padding: EdgeInsets.symmetric(horizontal: horizontalPadding),+ child: Stack(+ fit: StackFit.expand,+ children: [+ if (leading != null)+ Positioned(+ left: 0,+ top: leadingTop,+ child: IgnorePointer(+ ignoring: isLeadingHidden,+ child: ExcludeSemantics(+ excluding: isLeadingHidden,+ child: Opacity(+ opacity: leadingOpacity,+ child: ClipRRect(+ borderRadius: BorderRadius.circular(12),+ child: SizedBox.square(+ dimension: _headerControlSize,+ child: leading,+ ),+ ),+ ),+ ),),),+ _MovingHeaderTitle(+ title: title,+ titleBuilder: titleBuilder,+ onTap: onTitleTap,+ onDoubleTap: onTitleDoubleTap,+ onLongPress: onTitleLongPress,+ disableTapReveal: disableTitleTapReveal,+ top: titleTop,+ left: titleLeft,+ right: titleRight,+ progress: titleProgress,+ height: titleLayoutHeight,),- ),- ),- ),- _MovingHeaderTitle(- title: title,- titleBuilder: titleBuilder,- onTap: onTitleTap,- onDoubleTap: onTitleDoubleTap,- onLongPress: onTitleLongPress,- disableTapReveal: disableTitleTapReveal,- top: titleTop,- left: titleLeft,- right: titleRight,- progress: titleProgress,- height: titleLayoutHeight,- ),- if (subtitle != null)- Positioned(- left: titleLeft,- right: titleRight,- top: _expandedContentTop + expandedTitleHeight + _subtitleGap,- child: IgnorePointer(- child: ExcludeSemantics(- child: Opacity(- opacity: 1 - titleProgress,- child: Text(- subtitle!,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyles.mini.copyWith(- color: colors.textLight,+ if (subtitle != null)+ Positioned(+ left: titleLeft,+ right: titleRight,+ top:+ _expandedContentTop ++ expandedTitleHeight ++ _subtitleGap,+ child: IgnorePointer(+ child: ExcludeSemantics(+ child: Opacity(+ opacity: 1 - titleProgress,+ child: Text(+ subtitle!,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyles.mini.copyWith(+ color: colors.textLight,+ ),+ ),+ ),+ ),),),+ Positioned(+ top: 0,+ left: 0,+ right: 0,+ bottom: 0,+ child: _PinnedHeaderChrome(+ backButton: backButton,+ onBack: onBack,+ actions: actions,+ actionsTop: actionsTop,+ chromeHeight: collapsedHeight,+ showBackButton: showExpandedBackButton,+ ),),- ),+ ],),),- Positioned(- top: 0,- left: 0,- right: 0,- bottom: 0,- child: _PinnedHeaderChrome(- backButton: backButton,- onBack: onBack,- actions: actions,- actionsTop: actionsTop,- chromeHeight: collapsedHeight,- showBackButton: showExpandedBackButton,- ),),+ if (bottom != null)+ Positioned(+ left: 0,+ right: 0,+ bottom: 0,+ height: bottomHeight,+ child: bottom!,+ ),],),),@@ -569,6 +598,8 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {oldDelegate.backButton != backButton ||oldDelegate.onBack != onBack ||oldDelegate.actions != actions ||+ oldDelegate.bottom != bottom ||+ oldDelegate.bottomHeight != bottomHeight ||oldDelegate.expandedHeight != expandedHeight ||oldDelegate.collapsedHeight != collapsedHeight ||oldDelegate.horizontalPadding != horizontalPadding ||