@@ -6,6 +6,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
6
6
import 'package:immich_mobile/providers/album/album.provider.dart' ;
7
7
import 'package:immich_mobile/providers/asset_viewer/scroll_notifier.provider.dart' ;
8
8
import 'package:immich_mobile/providers/multiselect.provider.dart' ;
9
+ import 'package:immich_mobile/providers/search/search_input_focus.provider.dart' ;
9
10
import 'package:immich_mobile/routing/router.dart' ;
10
11
import 'package:immich_mobile/providers/asset.provider.dart' ;
11
12
import 'package:immich_mobile/providers/haptic_feedback.provider.dart' ;
@@ -44,21 +45,28 @@ class TabControllerPage extends HookConsumerWidget {
44
45
);
45
46
}
46
47
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
+
47
64
navigationRail (TabsRouter tabsRouter) {
48
65
return NavigationRail (
49
66
labelType: NavigationRailLabelType .all,
50
67
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),
62
70
selectedIconTheme: IconThemeData (
63
71
color: context.primaryColor,
64
72
),
@@ -103,16 +111,8 @@ class TabControllerPage extends HookConsumerWidget {
103
111
bottomNavigationBar (TabsRouter tabsRouter) {
104
112
return NavigationBar (
105
113
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),
116
116
destinations: [
117
117
NavigationDestination (
118
118
label: 'tab_controller_nav_photos' .tr (),
@@ -171,7 +171,7 @@ class TabControllerPage extends HookConsumerWidget {
171
171
return AutoTabsRouter (
172
172
routes: [
173
173
const PhotosRoute (),
174
- SearchInputRoute (),
174
+ SearchRoute (),
175
175
const AlbumsRoute (),
176
176
const LibraryRoute (),
177
177
],
0 commit comments