π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add app bar boundary reporting for ungrouped galleries
ashilkn2ef9e9b4551d
diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dartindex 874a60faf2..74611286c1 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/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";@@ -190,13 +191,23 @@ class _ClusterPageState extends State<ClusterPage> {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),- ),+ child: widget.enableGrouping+ ? ClusterAppBar(+ SearchResultPage.appBarType,+ "${files.length} memories${widget.appendTitle}",+ _selectedFiles,+ widget.clusterID,+ key: ValueKey(files.length),+ )+ : _AppBarWithBoundary(+ child: ClusterAppBar(+ SearchResultPage.appBarType,+ "${files.length} memories${widget.appendTitle}",+ _selectedFiles,+ widget.clusterID,+ key: ValueKey(files.length),+ ),+ ),),body: SelectionState(selectedFiles: _selectedFiles,@@ -217,3 +228,34 @@ class _ClusterPageState extends State<ClusterPage> {);}}++/// 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+ void initState() {+ super.initState();+ // Report boundary after the first frame+ WidgetsBinding.instance.addPostFrameCallback((_) {+ reportBoundary(BoundaryPosition.top);+ });+ }++ @override+ Widget build(BuildContext context) {+ return boundaryWidget(+ position: BoundaryPosition.top,+ child: widget.child,+ );+ }+}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.dartindex 3a8fec76a7..2d0b174a8c 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/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";@@ -165,12 +166,21 @@ class _ContactResultPageState extends State<ContactResultPage> {child: Scaffold(appBar: PreferredSize(preferredSize: const Size.fromHeight(90.0),- child: GalleryAppBarWidget(- key: ValueKey(_searchResultName),- ContactResultPage.appBarType,- _searchResultName,- _selectedFiles,- ),+ child: widget.enableGrouping+ ? GalleryAppBarWidget(+ key: ValueKey(_searchResultName),+ ContactResultPage.appBarType,+ _searchResultName,+ _selectedFiles,+ )+ : _AppBarWithBoundary(+ child: GalleryAppBarWidget(+ key: ValueKey(_searchResultName),+ ContactResultPage.appBarType,+ _searchResultName,+ _selectedFiles,+ ),+ ),),body: SelectionState(selectedFiles: _selectedFiles,@@ -256,3 +266,34 @@ class _AlbumsSection extends StatelessWidget {);}}++/// 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+ void initState() {+ super.initState();+ // Report boundary after the first frame+ WidgetsBinding.instance.addPostFrameCallback((_) {+ reportBoundary(BoundaryPosition.top);+ });+ }++ @override+ Widget build(BuildContext context) {+ return boundaryWidget(+ position: BoundaryPosition.top,+ child: widget.child,+ );+ }+}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 bdf482db24..bab4cf0d3d 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/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";@@ -183,11 +184,19 @@ class _MagicResultScreenState extends State<MagicResultScreen> {child: Scaffold(appBar: PreferredSize(preferredSize: const Size.fromHeight(90.0),- child: GalleryAppBarWidget(- MagicResultScreen.appBarType,- widget.name,- _selectedFiles,- ),+ child: _enableGrouping+ ? GalleryAppBarWidget(+ MagicResultScreen.appBarType,+ widget.name,+ _selectedFiles,+ )+ : _AppBarWithBoundary(+ child: GalleryAppBarWidget(+ MagicResultScreen.appBarType,+ widget.name,+ _selectedFiles,+ ),+ ),),body: SelectionState(selectedFiles: _selectedFiles,@@ -229,3 +238,34 @@ 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+ void initState() {+ super.initState();+ // Report boundary after the first frame+ WidgetsBinding.instance.addPostFrameCallback((_) {+ reportBoundary(BoundaryPosition.top);+ });+ }++ @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 0b74b2ea0e..d19d0c41f5 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/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";@@ -118,11 +119,19 @@ class _SearchResultPageState extends State<SearchResultPage> {child: Scaffold(appBar: PreferredSize(preferredSize: const Size.fromHeight(90.0),- child: GalleryAppBarWidget(- SearchResultPage.appBarType,- widget.searchResult.name(),- _selectedFiles,- ),+ child: widget.enableGrouping+ ? GalleryAppBarWidget(+ SearchResultPage.appBarType,+ widget.searchResult.name(),+ _selectedFiles,+ )+ : _AppBarWithBoundary(+ child: GalleryAppBarWidget(+ SearchResultPage.appBarType,+ widget.searchResult.name(),+ _selectedFiles,+ ),+ ),),body: SelectionState(selectedFiles: _selectedFiles,@@ -159,3 +168,34 @@ 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+ void initState() {+ super.initState();+ // Report boundary after the first frame+ WidgetsBinding.instance.addPostFrameCallback((_) {+ reportBoundary(BoundaryPosition.top);+ });+ }++ @override+ Widget build(BuildContext context) {+ return boundaryWidget(+ position: BoundaryPosition.top,+ child: widget.child,+ );+ }+}