Skip to content

Commit f59b813

Browse files
authored
chore(mobile): search page minor enhancements (immich-app#13403)
* chore(mobile): search page retouched * add placeholder photos * remove unused page * focus the search input when tapping on the search controller button * detail fixed * remove print statements * disable scrolling of empty content
1 parent 1193adf commit f59b813

14 files changed

+821
-847
lines changed

mobile/assets/polaroid-dark.png

314 KB
Loading

mobile/assets/polaroid-light.png

312 KB
Loading

mobile/lib/models/search/search_filter.model.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ class SearchFilter {
266266
AssetType? mediaType,
267267
}) {
268268
return SearchFilter(
269-
context: context ?? this.context,
270-
filename: filename ?? this.filename,
269+
context: context,
270+
filename: filename,
271271
people: people ?? this.people,
272272
location: location ?? this.location,
273273
camera: camera ?? this.camera,

mobile/lib/pages/common/tab_controller.page.dart

+22-22
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
66
import 'package:immich_mobile/providers/album/album.provider.dart';
77
import 'package:immich_mobile/providers/asset_viewer/scroll_notifier.provider.dart';
88
import 'package:immich_mobile/providers/multiselect.provider.dart';
9+
import 'package:immich_mobile/providers/search/search_input_focus.provider.dart';
910
import 'package:immich_mobile/routing/router.dart';
1011
import 'package:immich_mobile/providers/asset.provider.dart';
1112
import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
@@ -44,21 +45,28 @@ class TabControllerPage extends HookConsumerWidget {
4445
);
4546
}
4647

48+
onNavigationSelected(TabsRouter router, int index) {
49+
// On Photos page menu tapped
50+
if (router.activeIndex == 0 && index == 0) {
51+
scrollToTopNotifierProvider.scrollToTop();
52+
}
53+
54+
// On Search page tapped
55+
if (router.activeIndex == 1 && index == 1) {
56+
ref.read(searchInputFocusProvider).requestFocus();
57+
}
58+
59+
ref.read(hapticFeedbackProvider.notifier).selectionClick();
60+
router.setActiveIndex(index);
61+
ref.read(tabProvider.notifier).state = TabEnum.values[index];
62+
}
63+
4764
navigationRail(TabsRouter tabsRouter) {
4865
return NavigationRail(
4966
labelType: NavigationRailLabelType.all,
5067
selectedIndex: tabsRouter.activeIndex,
51-
onDestinationSelected: (index) {
52-
// Selected Photos while it is active
53-
if (tabsRouter.activeIndex == 0 && index == 0) {
54-
// Scroll to top
55-
scrollToTopNotifierProvider.scrollToTop();
56-
}
57-
58-
ref.read(hapticFeedbackProvider.notifier).selectionClick();
59-
tabsRouter.setActiveIndex(index);
60-
ref.read(tabProvider.notifier).state = TabEnum.values[index];
61-
},
68+
onDestinationSelected: (index) =>
69+
onNavigationSelected(tabsRouter, index),
6270
selectedIconTheme: IconThemeData(
6371
color: context.primaryColor,
6472
),
@@ -103,16 +111,8 @@ class TabControllerPage extends HookConsumerWidget {
103111
bottomNavigationBar(TabsRouter tabsRouter) {
104112
return NavigationBar(
105113
selectedIndex: tabsRouter.activeIndex,
106-
onDestinationSelected: (index) {
107-
if (tabsRouter.activeIndex == 0 && index == 0) {
108-
// Scroll to top
109-
scrollToTopNotifierProvider.scrollToTop();
110-
}
111-
112-
ref.read(hapticFeedbackProvider.notifier).selectionClick();
113-
tabsRouter.setActiveIndex(index);
114-
ref.read(tabProvider.notifier).state = TabEnum.values[index];
115-
},
114+
onDestinationSelected: (index) =>
115+
onNavigationSelected(tabsRouter, index),
116116
destinations: [
117117
NavigationDestination(
118118
label: 'tab_controller_nav_photos'.tr(),
@@ -171,7 +171,7 @@ class TabControllerPage extends HookConsumerWidget {
171171
return AutoTabsRouter(
172172
routes: [
173173
const PhotosRoute(),
174-
SearchInputRoute(),
174+
SearchRoute(),
175175
const AlbumsRoute(),
176176
const LibraryRoute(),
177177
],

mobile/lib/pages/library/library.page.dart

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ class QuickAccessButtons extends ConsumerWidget {
108108
colors: [
109109
context.colorScheme.primary.withAlpha(10),
110110
context.colorScheme.primary.withAlpha(15),
111+
context.colorScheme.primary.withAlpha(20),
111112
],
112113
begin: Alignment.topCenter,
113114
end: Alignment.bottomCenter,

mobile/lib/pages/library/places/places_collection.part.dart mobile/lib/pages/library/places/places_collection.page.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class PlaceTile extends StatelessWidget {
8181

8282
void navigateToPlace() {
8383
context.pushRoute(
84-
SearchInputRoute(
84+
SearchRoute(
8585
prefilter: SearchFilter(
8686
people: {},
8787
location: SearchLocationFilter(

0 commit comments

Comments
 (0)