Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add auto-scroll to all Gallery pages

ashilkn41e9f6c66d40
diff --git a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
index 19e34a9934..540087cd62 100644
--- a/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/home_gallery_widget.dart
@@ -18,6 +18,7 @@ import "package:photos/services/filter/db_filters.dart";
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import "package:photos/ui/viewer/gallery/component/group/type.dart";
import 'package:photos/ui/viewer/gallery/gallery.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/selection_state.dart";
import "package:photos/utils/standalone/debouncer.dart";
@@ -76,6 +77,11 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final gallery = Gallery(
key: ValueKey(_shouldHideSharedItems),
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
@@ -135,15 +141,23 @@ class _HomeGalleryWidgetState extends State<HomeGalleryWidget> {
groupType: widget.groupType,
showGallerySettingsCTA: true,
);
- return GalleryFilesState(
- child: SelectionState(
- selectedFiles: widget.selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(GalleryType.homepage, widget.selectedFiles),
- ],
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: SelectionState(
+ selectedFiles: widget.selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ GalleryType.homepage,
+ widget.selectedFiles,
+ ),
+ ],
+ ),
),
),
);
diff --git a/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart b/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart
index 5865ef81f4..9b94c22091 100644
--- a/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart
+++ b/mobile/apps/photos/lib/ui/map/map_pull_up_gallery.dart
@@ -15,6 +15,7 @@ import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/common/loading_widget.dart";
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/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
@@ -47,44 +48,57 @@ class _MapPullUpGalleryState extends State<MapPullUpGallery> {
final unsafeAreaProportion = widget.bottomUnsafeArea / screenHeight;
final double initialChildSize = 0.25 + unsafeAreaProportion;
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
Widget? cachedScrollableContent;
return DeferredPointerHandler(
- child: GalleryFilesState(
- child: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- clipBehavior: Clip.none,
- children: [
- DraggableScrollableSheet(
- expand: false,
- initialChildSize: initialChildSize,
- minChildSize: initialChildSize,
- maxChildSize: 0.8,
- snap: true,
- snapSizes: const [0.5],
- builder: (context, scrollController) {
- //Must use cached widget here to avoid rebuilds when DraggableScrollableSheet
- //is snapped to it's initialChildSize
- cachedScrollableContent ??=
- cacheScrollableContent(scrollController, context, logger);
- return cachedScrollableContent!;
- },
- ),
- DeferPointer(
- //This is to make the FileSelectionOverlayBar respect SafeArea
- child: MediaQuery(
- data: MediaQueryData.fromView(View.of(context)),
- child: FileSelectionOverlayBar(
- GalleryType.searchResults,
- _selectedFiles,
- backgroundColor:
- getEnteColorScheme(context).backgroundElevated2,
+ child: GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ clipBehavior: Clip.none,
+ children: [
+ DraggableScrollableSheet(
+ expand: false,
+ initialChildSize: initialChildSize,
+ minChildSize: initialChildSize,
+ maxChildSize: 0.8,
+ snap: true,
+ snapSizes: const [0.5],
+ builder: (context, scrollController) {
+ //Must use cached widget here to avoid rebuilds when DraggableScrollableSheet
+ //is snapped to it's initialChildSize
+ cachedScrollableContent ??= cacheScrollableContent(
+ scrollController,
+ context,
+ logger,
+ );
+ return cachedScrollableContent!;
+ },
+ ),
+ DeferPointer(
+ //This is to make the FileSelectionOverlayBar respect SafeArea
+ child: MediaQuery(
+ data: MediaQueryData.fromView(View.of(context)),
+ child: FileSelectionOverlayBar(
+ GalleryType.searchResults,
+ _selectedFiles,
+ backgroundColor:
+ getEnteColorScheme(context).backgroundElevated2,
+ ),
),
),
- ),
- ],
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart
index e79dcafc73..be1e194086 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart
@@ -15,6 +15,7 @@ import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import "package:photos/ui/viewer/gallery/empty_state.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/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
@@ -33,6 +34,11 @@ class ArchivePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final Set<int> hiddenCollectionIDs =
CollectionsService.instance.getHiddenCollectionIds();
final gallery = Gallery(
@@ -79,27 +85,32 @@ class ArchivePage extends StatelessWidget {
CollectionsService.instance.getArchivedCollection,
),
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: GalleryAppBarWidget(
- appBarType,
- AppLocalizations.of(context).archive,
- _selectedFiles,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(50.0),
+ child: GalleryAppBarWidget(
+ appBarType,
+ AppLocalizations.of(context).archive,
+ _selectedFiles,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- overlayType,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ overlayType,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),
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.dart
index e6ab0822c5..ae226c1ff6 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
@@ -22,6 +22,7 @@ import 'package:photos/ui/components/toggle_switch_widget.dart';
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/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
@@ -33,6 +34,11 @@ class DeviceFolderPage extends StatelessWidget {
@override
Widget build(Object context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final int? userID = Configuration.instance.getUserID();
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
@@ -58,28 +64,33 @@ class DeviceFolderPage extends StatelessWidget {
: const SizedBox.shrink(),
initialFiles: [deviceCollection.thumbnail!],
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: GalleryAppBarWidget(
- GalleryType.localFolder,
- deviceCollection.name,
- _selectedFiles,
- deviceCollection: deviceCollection,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(50.0),
+ child: GalleryAppBarWidget(
+ GalleryType.localFolder,
+ deviceCollection.name,
+ _selectedFiles,
+ deviceCollection: deviceCollection,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- GalleryType.localFolder,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ GalleryType.localFolder,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart
index 40c51b0ba0..1447ab72f0 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hidden_page.dart
@@ -19,6 +19,7 @@ import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import 'package:photos/ui/viewer/gallery/empty_hidden_widget.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/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
@@ -87,6 +88,11 @@ class _HiddenPageState extends State<HiddenPage> {
if (_defaultHiddenCollectionId == null) {
return const EnteLoadingWidget();
}
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
return FilesDB.instance.getFilesInCollections(
@@ -132,27 +138,32 @@ class _HiddenPageState extends State<HiddenPage> {
hasVerifiedLock: true,
),
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: GalleryAppBarWidget(
- widget.appBarType,
- AppLocalizations.of(context).hidden,
- _selectedFiles,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(50.0),
+ child: GalleryAppBarWidget(
+ widget.appBarType,
+ AppLocalizations.of(context).hidden,
+ _selectedFiles,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- widget.overlayType,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ widget.overlayType,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
index af41082df8..84a7698736 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
@@ -13,10 +13,12 @@ import "package:photos/services/search_service.dart";
import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
import "package:photos/ui/viewer/gallery/component/group/type.dart";
import 'package:photos/ui/viewer/gallery/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/selection_state.dart";
-class LargeFilesPagePage extends StatelessWidget {
+class LargeFilesPagePage extends StatefulWidget {
final String tagPrefix;
final GalleryType appBarType;
final GalleryType overlayType;
@@ -30,8 +32,17 @@ class LargeFilesPagePage extends StatelessWidget {
super.key,
});
+ @override
+ State<LargeFilesPagePage> createState() => _LargeFilesPagePageState();
+}
+
+class _LargeFilesPagePageState extends State<LargeFilesPagePage> {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
final List<EnteFile> allFiles =
@@ -43,7 +54,7 @@ class LargeFilesPagePage extends StatelessWidget {
if (file.isOwner &&
file.isUploaded &&
file.fileSize != null &&
- file.fileSize! > minLargeFileSize) {
+ file.fileSize! > LargeFilesPagePage.minLargeFileSize) {
if (!alreadyTracked.contains(file.uploadedFileID!)) {
filesWithSize.add(file);
alreadyTracked.add(file.uploadedFileID!);
@@ -62,43 +73,73 @@ class LargeFilesPagePage extends StatelessWidget {
forceReloadEvents: [
Bus.instance.on<CollectionMetaEvent>(),
],
- tagPrefix: tagPrefix,
- selectedFiles: _selectedFiles,
+ tagPrefix: widget.tagPrefix,
+ selectedFiles: widget._selectedFiles,
sortAsyncFn: () => false,
groupType: GroupType.size,
initialFiles: null,
albumName: AppLocalizations.of(context).viewLargeFiles,
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: AppBar(
- elevation: 0,
- centerTitle: false,
- title: Text(
- AppLocalizations.of(context).viewLargeFiles,
- style: Theme.of(context)
- .textTheme
- .headlineSmall!
- .copyWith(fontSize: 16),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: const PreferredSize(
+ preferredSize: Size.fromHeight(50.0),
+ child: _LargeFilesAppBar(),
+ ),
+ body: SelectionState(
+ selectedFiles: widget._selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ widget.overlayType,
+ widget._selectedFiles,
+ ),
+ ],
),
),
),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- overlayType,
- _selectedFiles,
- ),
- ],
- ),
+ ),
+ );
+ }
+}
+
+class _LargeFilesAppBar extends StatefulWidget {
+ const _LargeFilesAppBar();
+
+ @override
+ State<_LargeFilesAppBar> createState() => _LargeFilesAppBarState();
+}
+
+class _LargeFilesAppBarState extends State<_LargeFilesAppBar>
+ with BoundaryReporter {
+ @override
+ void initState() {
+ super.initState();
+ // Report boundary after initial build
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ reportBoundary(BoundaryPosition.top);
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return boundaryWidget(
+ position: BoundaryPosition.top,
+ child: AppBar(
+ elevation: 0,
+ centerTitle: false,
+ title: Text(
+ AppLocalizations.of(context).viewLargeFiles,
+ style:
+ Theme.of(context).textTheme.headlineSmall!.copyWith(fontSize: 16),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
),
),
);
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.dart
index 7d6b627782..946b9e5f52 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
@@ -22,6 +22,7 @@ import "package:photos/ui/viewer/actions/file_selection_overlay_bar.dart";
import "package:photos/ui/viewer/gallery/collection_page.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/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
import "package:photos/utils/dialog_util.dart";
@@ -67,6 +68,11 @@ class _SharedPublicCollectionPageState
@override
Widget build(BuildContext context) {
logger.info("Building SharedPublicCollectionPage");
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final List<EnteFile>? initialFiles =
widget.c.thumbnail != null ? [widget.c.thumbnail!] : null;
final gallery = Gallery(
@@ -120,30 +126,35 @@ class _SharedPublicCollectionPageState
sortAsyncFn: () => widget.c.collection.pubMagicMetadata.asc ?? false,
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: GalleryAppBarWidget(
- galleryType,
- widget.c.collection.displayName,
- _selectedFiles,
- collection: widget.c.collection,
- files: widget.files,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(50.0),
+ child: GalleryAppBarWidget(
+ galleryType,
+ widget.c.collection.displayName,
+ _selectedFiles,
+ collection: widget.c.collection,
+ files: widget.files,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- galleryType,
- _selectedFiles,
- collection: widget.c.collection,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ galleryType,
+ _selectedFiles,
+ collection: widget.c.collection,
+ ),
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
index 8207d22129..3c37505578 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
@@ -13,6 +13,7 @@ import 'package:photos/ui/common/bottom_shadow.dart';
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/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
import 'package:photos/utils/delete_file_util.dart';
@@ -31,6 +32,11 @@ class TrashPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final bool filesAreSelected = _selectedFiles.files.isNotEmpty;
final gallery = Gallery(
@@ -58,44 +64,49 @@ class TrashPage extends StatelessWidget {
initialFiles: null,
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: GalleryAppBarWidget(
- appBarType,
- AppLocalizations.of(context).trash,
- _selectedFiles,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(50.0),
+ child: GalleryAppBarWidget(
+ appBarType,
+ AppLocalizations.of(context).trash,
+ _selectedFiles,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- const BottomShadowWidget(
- offsetDy: 20,
- ),
- AnimatedContainer(
- duration: const Duration(milliseconds: 300),
- curve: Curves.easeInOut,
- height: filesAreSelected ? 0 : 80,
- child: AnimatedOpacity(
- duration: const Duration(milliseconds: 100),
- opacity: filesAreSelected ? 0.0 : 1.0,
- curve: Curves.easeIn,
- child: IgnorePointer(
- ignoring: filesAreSelected,
- child: const SafeArea(
- minimum: EdgeInsets.only(bottom: 6),
- child: BottomButtonsWidget(),
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ const BottomShadowWidget(
+ offsetDy: 20,
+ ),
+ AnimatedContainer(
+ duration: const Duration(milliseconds: 300),
+ curve: Curves.easeInOut,
+ height: filesAreSelected ? 0 : 80,
+ child: AnimatedOpacity(
+ duration: const Duration(milliseconds: 100),
+ opacity: filesAreSelected ? 0.0 : 1.0,
+ curve: Curves.easeIn,
+ child: IgnorePointer(
+ ignoring: filesAreSelected,
+ child: const SafeArea(
+ minimum: EdgeInsets.only(bottom: 6),
+ child: BottomButtonsWidget(),
+ ),
),
),
),
- ),
- FileSelectionOverlayBar(GalleryType.trash, _selectedFiles),
- ],
+ FileSelectionOverlayBar(GalleryType.trash, _selectedFiles),
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
index db11ad7f0a..13c4fe95b1 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/uncategorized_page.dart
@@ -16,6 +16,7 @@ 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/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";
import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
@@ -38,6 +39,11 @@ class UnCategorizedPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) async {
final FileLoadResult result =
@@ -79,52 +85,57 @@ class UnCategorizedPage extends StatelessWidget {
initialFiles: null,
albumName: AppLocalizations.of(context).uncategorized,
);
- return GalleryFilesState(
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: SearchFilterDataProvider(
- initialGalleryFilter: AlbumFilter(
- collectionID: collection.id,
- albumName: collection.displayName,
- occurrence: kMostRelevantFilter,
- ),
- ),
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
- child: GalleryAppBarWidget(
- appBarType,
- AppLocalizations.of(context).uncategorized,
- _selectedFiles,
- collection: collection,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: InheritedSearchFilterDataWrapper(
+ searchFilterDataProvider: SearchFilterDataProvider(
+ initialGalleryFilter: AlbumFilter(
+ collectionID: collection.id,
+ albumName: collection.displayName,
+ occurrence: kMostRelevantFilter,
),
),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- Builder(
- builder: (context) {
- return ValueListenableBuilder(
- valueListenable: InheritedSearchFilterData.of(context)
- .searchFilterDataProvider!
- .isSearchingNotifier,
- builder: (context, isSearching, _) {
- return isSearching
- ? HierarchicalSearchGallery(
- tagPrefix: tagPrefix,
- selectedFiles: _selectedFiles,
- )
- : gallery;
- },
- );
- },
- ),
- FileSelectionOverlayBar(
- overlayType,
- _selectedFiles,
- ),
- ],
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(90.0),
+ child: GalleryAppBarWidget(
+ appBarType,
+ AppLocalizations.of(context).uncategorized,
+ _selectedFiles,
+ collection: collection,
+ ),
+ ),
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ Builder(
+ builder: (context) {
+ return ValueListenableBuilder(
+ valueListenable: InheritedSearchFilterData.of(context)
+ .searchFilterDataProvider!
+ .isSearchingNotifier,
+ builder: (context, isSearching, _) {
+ return isSearching
+ ? HierarchicalSearchGallery(
+ tagPrefix: tagPrefix,
+ selectedFiles: _selectedFiles,
+ )
+ : gallery;
+ },
+ );
+ },
+ ),
+ FileSelectionOverlayBar(
+ overlayType,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart b/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart
index 26042f0e79..c592be80e7 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart
@@ -12,6 +12,7 @@ import "package:photos/services/filter/db_filters.dart";
import "package:photos/services/location_service.dart";
import 'package:photos/states/location_state.dart';
import "package:photos/ui/viewer/gallery/gallery.dart";
+import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
///This gallery will get rebuilt with the updated radius when
@@ -93,6 +94,12 @@ class _DynamicLocationGalleryWidgetState
if (snapshot.hasData) {
return LayoutBuilder(
builder: (context, constrains) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier =
+ ValueNotifier<ScrollController?>(null);
+
return SizedBox(
height: _galleryHeight(
min(
@@ -101,21 +108,26 @@ class _DynamicLocationGalleryWidgetState
),
constrains.maxWidth,
),
- child: GalleryFilesState(
- child: Gallery(
- loadingWidget: const SizedBox.shrink(),
- disableScroll: true,
- asyncLoader: (
- creationStartTime,
- creationEndTime, {
- limit,
- asc,
- }) async {
- return snapshot.data as FileLoadResult;
- },
- tagPrefix: widget.tagPrefix,
- enableFileGrouping: false,
- showSelectAll: false,
+ child: GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Gallery(
+ loadingWidget: const SizedBox.shrink(),
+ disableScroll: true,
+ asyncLoader: (
+ creationStartTime,
+ creationEndTime, {
+ limit,
+ asc,
+ }) async {
+ return snapshot.data as FileLoadResult;
+ },
+ tagPrefix: widget.tagPrefix,
+ enableFileGrouping: false,
+ showSelectAll: false,
+ ),
),
),
);
diff --git a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart
index d76360763a..71512c32c9 100644
--- a/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart
+++ b/mobile/apps/photos/lib/ui/viewer/location/location_screen.dart
@@ -23,6 +23,7 @@ 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/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";
import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
@@ -46,35 +47,45 @@ class _LocationScreenState extends State<LocationScreen> {
final locationTag =
InheritedLocationScreenState.of(context).locationTagEntity.item;
- return GalleryFilesState(
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: SearchFilterDataProvider(
- initialGalleryFilter: LocationFilter(
- locationTag: locationTag,
- occurrence: kMostRelevantFilter,
- ),
- ),
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size(double.infinity, heightOfAppBar),
- child: GalleryAppBarWidget(
- GalleryType.locationTag,
- locationTag.name,
- selectedFiles,
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: InheritedSearchFilterDataWrapper(
+ searchFilterDataProvider: SearchFilterDataProvider(
+ initialGalleryFilter: LocationFilter(
+ locationTag: locationTag,
+ occurrence: kMostRelevantFilter,
),
),
- body: Column(
- children: <Widget>[
- SizedBox(
- height: MediaQuery.of(context).size.height -
- (heightOfAppBar + heightOfStatusBar),
- width: double.infinity,
- child: LocationGalleryWidget(
- tagPrefix: widget.tagPrefix,
- selectedFiles: selectedFiles,
- ),
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const 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,
+ ),
+ ),
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
index dc10214615..874a60faf2 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
@@ -17,6 +17,7 @@ import "package:photos/services/machine_learning/ml_result.dart";
import "package:photos/ui/notification/toast.dart";
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/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
import "package:photos/ui/viewer/people/add_person_action_sheet.dart";
@@ -113,6 +114,11 @@ class _ClusterPageState extends State<ClusterPage> {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
final result = files
@@ -176,30 +182,35 @@ class _ClusterPageState extends State<ClusterPage> {
)
: null,
);
- return GalleryFilesState(
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(50.0),
- child: ClusterAppBar(
- SearchResultPage.appBarType,
- "${files.length} memories${widget.appendTitle}",
- _selectedFiles,
- widget.clusterID,
- key: ValueKey(files.length),
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(50.0),
+ child: ClusterAppBar(
+ SearchResultPage.appBarType,
+ "${files.length} memories${widget.appendTitle}",
+ _selectedFiles,
+ widget.clusterID,
+ key: ValueKey(files.length),
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- gallery,
- FileSelectionOverlayBar(
- ClusterPage.overlayType,
- _selectedFiles,
- clusterID: widget.clusterID,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ gallery,
+ FileSelectionOverlayBar(
+ ClusterPage.overlayType,
+ _selectedFiles,
+ clusterID: widget.clusterID,
+ ),
+ ],
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
index 6a8549642b..7374888e72 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
@@ -20,6 +20,7 @@ import "package:photos/ui/components/end_to_end_banner.dart";
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/hierarchical_search_gallery.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";
import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
@@ -129,85 +130,96 @@ class _PeoplePageState extends State<PeoplePage> {
@override
Widget build(BuildContext context) {
_logger.info("Building for ${_person.data.name}");
- return GalleryFilesState(
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: _searchFilterDataProvider,
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize:
- Size.fromHeight(widget.searchResult != null ? 90.0 : 50.0),
- child: PeopleAppBar(
- GalleryType.peopleTag,
- _person.data.isIgnored
- ? AppLocalizations.of(context).ignored
- : _person.data.name,
- _selectedFiles,
- _person,
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: InheritedSearchFilterDataWrapper(
+ searchFilterDataProvider: _searchFilterDataProvider,
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize:
+ Size.fromHeight(widget.searchResult != null ? 90.0 : 50.0),
+ child: PeopleAppBar(
+ GalleryType.peopleTag,
+ _person.data.isIgnored
+ ? AppLocalizations.of(context).ignored
+ : _person.data.name,
+ _selectedFiles,
+ _person,
+ ),
),
- ),
- body: FutureBuilder<List<EnteFile>>(
- future: filesFuture,
- builder: (context, snapshot) {
- final inheritedSearchFilterData = InheritedSearchFilterData.of(
- context,
- );
- if (snapshot.hasData) {
- final personFiles = snapshot.data as List<EnteFile>;
- return SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- inheritedSearchFilterData.isHierarchicalSearchable
- ? ValueListenableBuilder(
- valueListenable: inheritedSearchFilterData
- .searchFilterDataProvider!
- .isSearchingNotifier,
- builder: (
- context,
- value,
- _,
- ) {
- return value
- ? HierarchicalSearchGallery(
- tagPrefix: widget.tagPrefix,
- selectedFiles: _selectedFiles,
- )
- : _Gallery(
- tagPrefix: widget.tagPrefix,
- selectedFiles: _selectedFiles,
- personFiles: personFiles,
- loadPersonFiles: loadPersonFiles,
- personEntity: _person,
- );
- },
- )
- : _Gallery(
- tagPrefix: widget.tagPrefix,
- selectedFiles: _selectedFiles,
- personFiles: personFiles,
- loadPersonFiles: loadPersonFiles,
- personEntity: _person,
- ),
- FileSelectionOverlayBar(
- PeoplePage.overlayType,
- _selectedFiles,
- person: _person,
- ),
- ],
- ),
+ body: FutureBuilder<List<EnteFile>>(
+ future: filesFuture,
+ builder: (context, snapshot) {
+ final inheritedSearchFilterData = InheritedSearchFilterData.of(
+ context,
);
- } else if (snapshot.hasError) {
- _logger
- .severe("Error: ${snapshot.error} ${snapshot.stackTrace}}");
- //Need to show an error on the UI here
- return const SizedBox.shrink();
- } else {
- return const Center(
- child: CircularProgressIndicator(),
- );
- }
- },
+ if (snapshot.hasData) {
+ final personFiles = snapshot.data as List<EnteFile>;
+ return SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ inheritedSearchFilterData.isHierarchicalSearchable
+ ? ValueListenableBuilder(
+ valueListenable: inheritedSearchFilterData
+ .searchFilterDataProvider!
+ .isSearchingNotifier,
+ builder: (
+ context,
+ value,
+ _,
+ ) {
+ return value
+ ? HierarchicalSearchGallery(
+ tagPrefix: widget.tagPrefix,
+ selectedFiles: _selectedFiles,
+ )
+ : _Gallery(
+ tagPrefix: widget.tagPrefix,
+ selectedFiles: _selectedFiles,
+ personFiles: personFiles,
+ loadPersonFiles: loadPersonFiles,
+ personEntity: _person,
+ );
+ },
+ )
+ : _Gallery(
+ tagPrefix: widget.tagPrefix,
+ selectedFiles: _selectedFiles,
+ personFiles: personFiles,
+ loadPersonFiles: loadPersonFiles,
+ personEntity: _person,
+ ),
+ FileSelectionOverlayBar(
+ PeoplePage.overlayType,
+ _selectedFiles,
+ person: _person,
+ ),
+ ],
+ ),
+ );
+ } else if (snapshot.hasError) {
+ _logger.severe(
+ "Error: ${snapshot.error} ${snapshot.stackTrace}}",
+ );
+ //Need to show an error on the UI here
+ return const SizedBox.shrink();
+ } else {
+ return const Center(
+ child: CircularProgressIndicator(),
+ );
+ }
+ },
+ ),
),
),
),
@@ -239,72 +251,82 @@ class _GalleryState extends State<_Gallery> {
@override
Widget build(BuildContext context) {
- return Gallery(
- asyncLoader: (
- creationStartTime,
- creationEndTime, {
- limit,
- asc,
- }) async {
- final result = await widget.loadPersonFiles();
- return Future.value(
- FileLoadResult(
- result,
- false,
- ),
- );
- },
- reloadEvent: Bus.instance.on<LocalPhotosUpdatedEvent>(),
- forceReloadEvents: [Bus.instance.on<PeopleChangedEvent>()],
- removalEventTypes: const {
- EventType.deletedFromRemote,
- EventType.deletedFromEverywhere,
- EventType.hide,
- },
- tagPrefix: widget.tagPrefix + widget.tagPrefix,
- selectedFiles: widget.selectedFiles,
- initialFiles:
- widget.personFiles.isNotEmpty ? [widget.personFiles.first] : [],
- header: Column(
- children: [
- (widget.personEntity.data.email != null &&
- widget.personEntity.data.email!.isNotEmpty) ||
- widget.personEntity.data.isIgnored
- ? const SizedBox.shrink()
- : Padding(
- padding: const EdgeInsets.only(top: 12, bottom: 8),
- child: EndToEndBanner(
- title: context.l10n.linkEmail,
- caption: context.l10n.linkEmailToContactBannerCaption,
- leadingIcon: Icons.email_outlined,
- onTap: () async {
- await routeToPage(
- context,
- LinkEmailScreen(widget.personEntity.remoteID),
- );
- },
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: Gallery(
+ asyncLoader: (
+ creationStartTime,
+ creationEndTime, {
+ limit,
+ asc,
+ }) async {
+ final result = await widget.loadPersonFiles();
+ return Future.value(
+ FileLoadResult(
+ result,
+ false,
+ ),
+ );
+ },
+ reloadEvent: Bus.instance.on<LocalPhotosUpdatedEvent>(),
+ forceReloadEvents: [Bus.instance.on<PeopleChangedEvent>()],
+ removalEventTypes: const {
+ EventType.deletedFromRemote,
+ EventType.deletedFromEverywhere,
+ EventType.hide,
+ },
+ tagPrefix: widget.tagPrefix + widget.tagPrefix,
+ selectedFiles: widget.selectedFiles,
+ initialFiles:
+ widget.personFiles.isNotEmpty ? [widget.personFiles.first] : [],
+ header: Column(
+ children: [
+ (widget.personEntity.data.email != null &&
+ widget.personEntity.data.email!.isNotEmpty) ||
+ widget.personEntity.data.isIgnored
+ ? const SizedBox.shrink()
+ : Padding(
+ padding: const EdgeInsets.only(top: 12, bottom: 8),
+ child: EndToEndBanner(
+ title: context.l10n.linkEmail,
+ caption: context.l10n.linkEmailToContactBannerCaption,
+ leadingIcon: Icons.email_outlined,
+ onTap: () async {
+ await routeToPage(
+ context,
+ LinkEmailScreen(widget.personEntity.remoteID),
+ );
+ },
+ ),
),
- ),
- !userDismissedPersonGallerySuggestion
- ? Dismissible(
- key: const Key("personGallerySuggestion"),
- direction: DismissDirection.horizontal,
- onDismissed: (direction) {
- setState(() {
- userDismissedPersonGallerySuggestion = true;
- });
- },
- child: PersonGallerySuggestion(
- person: widget.personEntity,
- onClose: () {
+ !userDismissedPersonGallerySuggestion
+ ? Dismissible(
+ key: const Key("personGallerySuggestion"),
+ direction: DismissDirection.horizontal,
+ onDismissed: (direction) {
setState(() {
userDismissedPersonGallerySuggestion = true;
});
},
- ),
- )
- : const SizedBox.shrink(),
- ],
+ child: PersonGallerySuggestion(
+ person: widget.personEntity,
+ onClose: () {
+ setState(() {
+ userDismissedPersonGallerySuggestion = true;
+ });
+ },
+ ),
+ )
+ : const SizedBox.shrink(),
+ ],
+ ),
),
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
index 0c71d74318..3a8fec76a7 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
@@ -23,6 +23,7 @@ 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/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";
import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
@@ -91,6 +92,11 @@ class _ContactResultPageState extends State<ContactResultPage> {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
final result = files
@@ -149,46 +155,51 @@ class _ContactResultPageState extends State<ContactResultPage> {
),
);
- return GalleryFilesState(
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: _searchFilterDataProvider,
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
- child: GalleryAppBarWidget(
- key: ValueKey(_searchResultName),
- ContactResultPage.appBarType,
- _searchResultName,
- _selectedFiles,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: InheritedSearchFilterDataWrapper(
+ searchFilterDataProvider: _searchFilterDataProvider,
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(90.0),
+ child: GalleryAppBarWidget(
+ key: ValueKey(_searchResultName),
+ ContactResultPage.appBarType,
+ _searchResultName,
+ _selectedFiles,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- Builder(
- builder: (context) {
- return ValueListenableBuilder(
- valueListenable: InheritedSearchFilterData.of(context)
- .searchFilterDataProvider!
- .isSearchingNotifier,
- builder: (context, value, _) {
- return value
- ? HierarchicalSearchGallery(
- tagPrefix: widget.tagPrefix,
- selectedFiles: _selectedFiles,
- )
- : gallery;
- },
- );
- },
- ),
- FileSelectionOverlayBar(
- ContactResultPage.overlayType,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ Builder(
+ builder: (context) {
+ return ValueListenableBuilder(
+ valueListenable: InheritedSearchFilterData.of(context)
+ .searchFilterDataProvider!
+ .isSearchingNotifier,
+ builder: (context, value, _) {
+ return value
+ ? HierarchicalSearchGallery(
+ tagPrefix: widget.tagPrefix,
+ selectedFiles: _selectedFiles,
+ )
+ : gallery;
+ },
+ );
+ },
+ ),
+ FileSelectionOverlayBar(
+ ContactResultPage.overlayType,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),
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.dart
index b5c2a87543..bdf482db24 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
@@ -15,6 +15,7 @@ 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/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";
import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
@@ -139,6 +140,11 @@ class _MagicResultScreenState extends State<MagicResultScreen> {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final gallery = Gallery(
key: ValueKey(_enableGrouping),
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
@@ -167,50 +173,55 @@ class _MagicResultScreenState extends State<MagicResultScreen> {
enableFileGrouping: _enableGrouping,
initialFiles: [files.first],
);
- return GalleryFilesState(
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: _searchFilterDataProvider,
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
- child: GalleryAppBarWidget(
- MagicResultScreen.appBarType,
- widget.name,
- _selectedFiles,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: InheritedSearchFilterDataWrapper(
+ searchFilterDataProvider: _searchFilterDataProvider,
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(90.0),
+ child: GalleryAppBarWidget(
+ MagicResultScreen.appBarType,
+ widget.name,
+ _selectedFiles,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- Builder(
- builder: (context) {
- return ValueListenableBuilder(
- valueListenable: InheritedSearchFilterData.of(context)
- .searchFilterDataProvider!
- .isSearchingNotifier,
- builder: (context, value, _) {
- return value
- ? HierarchicalSearchGallery(
- tagPrefix: widget.heroTag,
- selectedFiles: _selectedFiles,
- )
- : AnimatedSwitcher(
- duration: const Duration(milliseconds: 250),
- switchInCurve: Curves.easeInOutQuad,
- switchOutCurve: Curves.easeInOutQuad,
- child: gallery,
- );
- },
- );
- },
- ),
- FileSelectionOverlayBar(
- MagicResultScreen.overlayType,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ Builder(
+ builder: (context) {
+ return ValueListenableBuilder(
+ valueListenable: InheritedSearchFilterData.of(context)
+ .searchFilterDataProvider!
+ .isSearchingNotifier,
+ builder: (context, value, _) {
+ return value
+ ? HierarchicalSearchGallery(
+ tagPrefix: widget.heroTag,
+ selectedFiles: _selectedFiles,
+ )
+ : AnimatedSwitcher(
+ duration: const Duration(milliseconds: 250),
+ switchInCurve: Curves.easeInOutQuad,
+ switchOutCurve: Curves.easeInOutQuad,
+ child: gallery,
+ );
+ },
+ );
+ },
+ ),
+ FileSelectionOverlayBar(
+ MagicResultScreen.overlayType,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),
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.dart
index e2ec7bf016..0b74b2ea0e 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,6 +13,7 @@ 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/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";
import "package:photos/ui/viewer/gallery/state/search_filter_data_provider.dart";
@@ -72,6 +73,11 @@ class _SearchResultPageState extends State<SearchResultPage> {
@override
Widget build(BuildContext context) {
+ // Create boundary notifiers
+ final topBoundaryNotifier = ValueNotifier<double?>(null);
+ final bottomBoundaryNotifier = ValueNotifier<double?>(null);
+ final scrollControllerNotifier = ValueNotifier<ScrollController?>(null);
+
final gallery = Gallery(
asyncLoader: (creationStartTime, creationEndTime, {limit, asc}) {
final result = files
@@ -102,45 +108,50 @@ class _SearchResultPageState extends State<SearchResultPage> {
: null,
);
- return GalleryFilesState(
- child: InheritedSearchFilterDataWrapper(
- searchFilterDataProvider: _searchFilterDataProvider,
- child: Scaffold(
- appBar: PreferredSize(
- preferredSize: const Size.fromHeight(90.0),
- child: GalleryAppBarWidget(
- SearchResultPage.appBarType,
- widget.searchResult.name(),
- _selectedFiles,
+ return GalleryBoundariesProvider(
+ topBoundaryNotifier: topBoundaryNotifier,
+ bottomBoundaryNotifier: bottomBoundaryNotifier,
+ scrollControllerNotifier: scrollControllerNotifier,
+ child: GalleryFilesState(
+ child: InheritedSearchFilterDataWrapper(
+ searchFilterDataProvider: _searchFilterDataProvider,
+ child: Scaffold(
+ appBar: PreferredSize(
+ preferredSize: const Size.fromHeight(90.0),
+ child: GalleryAppBarWidget(
+ SearchResultPage.appBarType,
+ widget.searchResult.name(),
+ _selectedFiles,
+ ),
),
- ),
- body: SelectionState(
- selectedFiles: _selectedFiles,
- child: Stack(
- alignment: Alignment.bottomCenter,
- children: [
- Builder(
- builder: (context) {
- return ValueListenableBuilder(
- valueListenable: InheritedSearchFilterData.of(context)
- .searchFilterDataProvider!
- .isSearchingNotifier,
- builder: (context, value, _) {
- return value
- ? HierarchicalSearchGallery(
- tagPrefix: widget.tagPrefix,
- selectedFiles: _selectedFiles,
- )
- : gallery;
- },
- );
- },
- ),
- FileSelectionOverlayBar(
- SearchResultPage.overlayType,
- _selectedFiles,
- ),
- ],
+ body: SelectionState(
+ selectedFiles: _selectedFiles,
+ child: Stack(
+ alignment: Alignment.bottomCenter,
+ children: [
+ Builder(
+ builder: (context) {
+ return ValueListenableBuilder(
+ valueListenable: InheritedSearchFilterData.of(context)
+ .searchFilterDataProvider!
+ .isSearchingNotifier,
+ builder: (context, value, _) {
+ return value
+ ? HierarchicalSearchGallery(
+ tagPrefix: widget.tagPrefix,
+ selectedFiles: _selectedFiles,
+ )
+ : gallery;
+ },
+ );
+ },
+ ),
+ FileSelectionOverlayBar(
+ SearchResultPage.overlayType,
+ _selectedFiles,
+ ),
+ ],
+ ),
),
),
),