Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move top boundary reporting from GalleryAppBarWidget to PinnedGroupHeader

ashilkn13e5771d4dc0
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
index 7504d4feb4..9db4eff5f4 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
@@ -27,6 +27,7 @@ import "package:photos/ui/viewer/gallery/component/group/type.dart";
import "package:photos/ui/viewer/gallery/component/sectioned_sliver_list.dart";
import 'package:photos/ui/viewer/gallery/empty_state.dart';
import "package:photos/ui/viewer/gallery/scrollbar/custom_scroll_bar.dart";
+import "package:photos/ui/viewer/gallery/state/boundary_reporter_mixin.dart";
import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_context_state.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
@@ -733,7 +734,8 @@ class PinnedGroupHeader extends StatefulWidget {
State<PinnedGroupHeader> createState() => _PinnedGroupHeaderState();
}
-class _PinnedGroupHeaderState extends State<PinnedGroupHeader> {
+class _PinnedGroupHeaderState extends State<PinnedGroupHeader>
+ with BoundaryReporter {
String? currentGroupId;
final _enlargeHeader = ValueNotifier<bool>(false);
Timer? _enlargeHeaderTimer;
@@ -753,6 +755,11 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader> {
_scrollControllerListenerForZeroScrollNotifier,
);
widget.headerHeightNotifier.addListener(_headerHeightNotifierListener);
+
+ // Report boundary after initial build
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ reportBoundary(BoundaryPosition.top);
+ });
}
@override
@@ -909,25 +916,28 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader> {
},
child: ColoredBox(
color: getEnteColorScheme(context).backgroundBase,
- child: GroupHeaderWidget(
- title: widget.galleryGroups
- .groupIdToGroupDataMap[currentGroupId!]!.groupType
- .getTitle(
- context,
- widget.galleryGroups.groupIDToFilesMap[currentGroupId]!
- .first,
+ child: boundaryWidget(
+ position: BoundaryPosition.top,
+ child: GroupHeaderWidget(
+ title: widget.galleryGroups
+ .groupIdToGroupDataMap[currentGroupId!]!.groupType
+ .getTitle(
+ context,
+ widget.galleryGroups
+ .groupIDToFilesMap[currentGroupId]!.first,
+ ),
+ gridSize: localSettings.getPhotoGridSize(),
+ height: widget.galleryGroups.groupHeaderExtent,
+ filesInGroup: widget
+ .galleryGroups.groupIDToFilesMap[currentGroupId!]!,
+ selectedFiles: widget.selectedFiles,
+ showSelectAll: widget.showSelectAll,
+ showGalleryLayoutSettingCTA:
+ widget.showGallerySettingsCTA,
+ showTrailingIcons: !inUse,
+ isPinnedHeader: true,
+ fadeInTrailingIcons: fadeInTrailingIcons,
),
- gridSize: localSettings.getPhotoGridSize(),
- height: widget.galleryGroups.groupHeaderExtent,
- filesInGroup: widget
- .galleryGroups.groupIDToFilesMap[currentGroupId!]!,
- selectedFiles: widget.selectedFiles,
- showSelectAll: widget.showSelectAll,
- showGalleryLayoutSettingCTA:
- widget.showGallerySettingsCTA,
- showTrailingIcons: !inUse,
- isPinnedHeader: true,
- fadeInTrailingIcons: fadeInTrailingIcons,
),
),
),
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.dart
index fe22a22c4d..1afd17ba8a 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
@@ -54,7 +54,6 @@ import 'package:photos/ui/tools/free_space_page.dart';
import "package:photos/ui/viewer/file/detail_page.dart";
import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";
import 'package:photos/ui/viewer/gallery/hooks/pick_cover_photo.dart';
-import "package:photos/ui/viewer/gallery/state/boundary_reporter_mixin.dart";
import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";
import "package:photos/ui/viewer/hierarchicial_search/applied_filters_for_appbar.dart";
import "package:photos/ui/viewer/hierarchicial_search/recommended_filters_for_appbar.dart";
@@ -115,8 +114,7 @@ enum AlbumPopupAction {
galleryGuestView,
}
-class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget>
- with BoundaryReporter {
+class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
final _logger = Logger("GalleryAppBar");
late StreamSubscription _userAuthEventSubscription;
late StreamSubscription<CollectionMetaEvent> _collectionMetaEventSubscription;
@@ -149,11 +147,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget>
)
.listen(stateRefresh);
- // Report boundary after initial build
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
-
_appBarTitle = widget.title;
galleryType = widget.type;
}
@@ -178,7 +171,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget>
final isHierarchicalSearchable =
inheritedSearchFilterData?.isHierarchicalSearchable ?? false;
- final appBar = galleryType == GalleryType.homepage
+ return galleryType == GalleryType.homepage
? const SizedBox.shrink()
: isHierarchicalSearchable
? ValueListenableBuilder(
@@ -227,14 +220,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget>
),
actions: _getDefaultActions(context),
);
-
- // Wrap with boundary widget only if not homepage
- return galleryType == GalleryType.homepage
- ? appBar
- : boundaryWidget(
- position: BoundaryPosition.top,
- child: appBar,
- );
}
Future<dynamic> _renameAlbum(BuildContext context) async {