Skip to content

armgit / ente

Public Imported from GitHub
0

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

Enable auto-scroll in add photos sheet and clean up dynamic location gallery

ashilkn90d8602a870b
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
index 71c11b2b7c..dcc4b79b3a 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
@@ -24,6 +24,7 @@ import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/components/title_bar_title_widget.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_files_inherited_widget.dart";
import "package:photos/utils/dialog_util.dart";
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
@@ -87,13 +88,15 @@ class AddPhotosPhotoWidget extends StatelessWidget {
Expanded(
child: Column(
children: [
- BottomOfTitleBarWidget(
- title: TitleBarTitleWidget(
- title: AppLocalizations.of(context).addMore,
+ _TitleWithBoundary(
+ child: BottomOfTitleBarWidget(
+ title: TitleBarTitleWidget(
+ title: AppLocalizations.of(context).addMore,
+ ),
+ caption:
+ AppLocalizations.of(context).selectItemsToAdd,
+ showCloseButton: true,
),
- caption:
- AppLocalizations.of(context).selectItemsToAdd,
- showCloseButton: true,
),
Expanded(
child: DelayedGallery(
@@ -326,3 +329,31 @@ class _DelayedGalleryState extends State<DelayedGallery> {
}
}
}
+
+class _TitleWithBoundary extends StatefulWidget {
+ final Widget child;
+
+ const _TitleWithBoundary({required this.child});
+
+ @override
+ State<_TitleWithBoundary> createState() => _TitleWithBoundaryState();
+}
+
+class _TitleWithBoundaryState extends State<_TitleWithBoundary>
+ with BoundaryReporter {
+ @override
+ void initState() {
+ super.initState();
+ 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/location/dynamic_location_gallery_widget.dart b/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart
index c592be80e7..26042f0e79 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,7 +12,6 @@ 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
@@ -94,12 +93,6 @@ 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(
@@ -108,26 +101,21 @@ class _DynamicLocationGalleryWidgetState
),
constrains.maxWidth,
),
- 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,
- ),
+ 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,
),
),
);