@@ -5,18 +5,19 @@ import 'package:flutter_hooks/flutter_hooks.dart';
5
5
import 'package:hooks_riverpod/hooks_riverpod.dart' ;
6
6
import 'package:i18next/i18next.dart' ;
7
7
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart' ;
8
+ import 'package:sidekick/src/components/organisms/app_bottom_bar.dart' ;
9
+ import 'package:sidekick/src/modules/common/utils/indexed_transition_switcher.dart' ;
10
+ import 'package:sidekick/src/modules/search/components/search_bar.dart' ;
11
+ import 'package:sidekick/src/modules/selected_detail/components/info_drawer.dart' ;
8
12
9
13
import '../../components/molecules/top_app_bar.dart' ;
10
- import '../../components/organisms/app_bottom_bar.dart' ;
11
14
import '../../components/organisms/shortcut_manager.dart' ;
12
15
import '../../modules/common/utils/layout_size.dart' ;
13
16
import '../../theme.dart' ;
14
17
import '../fvm/fvm.screen.dart' ;
15
18
import '../navigation/navigation.provider.dart' ;
16
19
import '../projects/projects.screen.dart' ;
17
20
import '../releases/releases.screen.dart' ;
18
- import '../search/components/search_bar.dart' ;
19
- import '../selected_detail/components/info_drawer.dart' ;
20
21
import '../selected_detail/selected_detail.provider.dart' ;
21
22
import 'constants.dart' ;
22
23
@@ -33,12 +34,29 @@ class AppShell extends HookWidget {
33
34
/// Constructor
34
35
const AppShell ({Key key}) : super (key: key);
35
36
37
+ NavigationRailDestination renderNavButton (
38
+ BuildContext context,
39
+ String label,
40
+ IconData iconData,
41
+ ) {
42
+ return NavigationRailDestination (
43
+ icon: Icon (iconData, size: 20 ),
44
+ selectedIcon: Icon (
45
+ iconData,
46
+ size: 20 ,
47
+ color: Theme .of (context).colorScheme.secondary,
48
+ ),
49
+ label: Text (label),
50
+ );
51
+ }
52
+
36
53
@override
37
54
Widget build (BuildContext context) {
38
- LayoutSize .init (context);
55
+ // LayoutSize.init(context);
39
56
final navigation = useProvider (navigationProvider.notifier);
40
57
final currentRoute = useProvider (navigationProvider);
41
58
final selectedInfo = useProvider (selectedDetailProvider).state;
59
+ final focusNode = useFocusNode ();
42
60
43
61
// Index of item selected
44
62
final selectedIndex = useState (0 );
@@ -65,19 +83,8 @@ class AppShell extends HookWidget {
65
83
}
66
84
});
67
85
68
- NavigationRailDestination renderNavButton (String label, IconData iconData) {
69
- return NavigationRailDestination (
70
- icon: Icon (iconData, size: 20 ),
71
- selectedIcon: Icon (
72
- iconData,
73
- size: 20 ,
74
- color: Theme .of (context).colorScheme.secondary,
75
- ),
76
- label: Text (label),
77
- );
78
- }
79
-
80
86
return SkShortcutManager (
87
+ focusNode: focusNode,
81
88
child: Scaffold (
82
89
appBar: const SkAppBar (),
83
90
bottomNavigationBar: const AppBottomBar (),
@@ -97,14 +104,17 @@ class AppShell extends HookWidget {
97
104
},
98
105
destinations: [
99
106
renderNavButton (
107
+ context,
100
108
I18Next .of (context).t ('modules:common.navButtonDashboard' ),
101
109
Icons .category,
102
110
),
103
111
renderNavButton (
112
+ context,
104
113
I18Next .of (context).t ('modules:common.navButtonProjects' ),
105
114
MdiIcons .folderMultiple,
106
115
),
107
116
renderNavButton (
117
+ context,
108
118
I18Next .of (context).t ('modules:common.navButtonExplore' ),
109
119
Icons .explore,
110
120
),
@@ -124,7 +134,7 @@ class AppShell extends HookWidget {
124
134
children: < Widget > [
125
135
// This is the main content.
126
136
Expanded (
127
- child: PageTransitionSwitcher (
137
+ child: IndexedTransitionSwitcher (
128
138
duration: const Duration (milliseconds: 250 ),
129
139
reverse: selectedIndex.value <
130
140
(navigation.previous.index ?? 0 ),
@@ -142,7 +152,8 @@ class AppShell extends HookWidget {
142
152
child: child,
143
153
);
144
154
},
145
- child: pages[selectedIndex.value],
155
+ index: selectedIndex.value,
156
+ children: pages,
146
157
),
147
158
),
148
159
],
0 commit comments