From 7504e01bf700598261aa5d2eda30cbc2fe81c25a Mon Sep 17 00:00:00 2001 From: ashilkn Date: Mon, 7 Oct 2024 20:14:46 +0530 Subject: [PATCH] [mob][photos] Enable hierarchical search in location screen --- .../gallery/gallery_app_bar_widget.dart | 3 +- .../ui/viewer/location/location_screen.dart | 63 ++++++++++++------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart index 29f2efb66f..ad3c42c89b 100644 --- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart +++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart @@ -163,7 +163,8 @@ class _GalleryAppBarWidgetState extends State { ), // actions: _getDefaultActions(context), bottom: galleryType == GalleryType.searchResults || - galleryType == GalleryType.ownedCollection + galleryType == GalleryType.ownedCollection || + galleryType == GalleryType.locationTag ? const PreferredSize( preferredSize: Size.fromHeight(0), child: Flexible(child: RecommendedFilters()), diff --git a/mobile/lib/ui/viewer/location/location_screen.dart b/mobile/lib/ui/viewer/location/location_screen.dart index d3a4ad8751..7c87686159 100644 --- a/mobile/lib/ui/viewer/location/location_screen.dart +++ b/mobile/lib/ui/viewer/location/location_screen.dart @@ -22,6 +22,7 @@ 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/gallery_app_bar_widget.dart"; +import "package:photos/ui/viewer/gallery/hierarchical_search_gallery.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"; @@ -190,29 +191,47 @@ class _LocationGalleryWidgetState extends State { child: Stack( alignment: Alignment.bottomCenter, children: [ - Gallery( - loadingWidget: Column( - children: [ - EnteLoadingWidget( - color: getEnteColorScheme(context).strokeMuted, - ), - ], - ), - asyncLoader: ( - creationStartTime, - creationEndTime, { - limit, - asc, - }) async { - return snapshot.data as FileLoadResult; + Builder( + builder: (context) { + return ValueListenableBuilder( + valueListenable: InheritedSearchFilterData.of(context) + .searchFilterDataProvider! + .isSearchingNotifier, + builder: (context, value, _) { + return value + ? HierarchicalSearchGallery( + tagPrefix: widget.tagPrefix, + selectedFiles: _selectedFiles, + ) + : Gallery( + loadingWidget: Column( + children: [ + EnteLoadingWidget( + color: getEnteColorScheme(context) + .strokeMuted, + ), + ], + ), + asyncLoader: ( + creationStartTime, + creationEndTime, { + limit, + asc, + }) async { + return snapshot.data as FileLoadResult; + }, + reloadEvent: + Bus.instance.on(), + removalEventTypes: const { + EventType.deletedFromRemote, + EventType.deletedFromEverywhere, + }, + selectedFiles: _selectedFiles, + tagPrefix: widget.tagPrefix, + ); + }, + ); }, - reloadEvent: Bus.instance.on(), - removalEventTypes: const { - EventType.deletedFromRemote, - EventType.deletedFromEverywhere, - }, - selectedFiles: _selectedFiles, - tagPrefix: widget.tagPrefix, ), FileSelectionOverlayBar( GalleryType.locationTag,