@@ -136,7 +136,7 @@ class _BottomNavigationPageState extends State<BottomNavigationPage> {
136136 selectedIcon: FluentIcons .home_24_filled,
137137 label: context.l10n? .home ?? 'Home' ,
138138 route: '/home' ,
139- index : 0 ,
139+ shellIndex : 0 ,
140140 ),
141141 ];
142142
@@ -148,29 +148,25 @@ class _BottomNavigationPageState extends State<BottomNavigationPage> {
148148 selectedIcon: FluentIcons .search_24_filled,
149149 label: context.l10n? .search ?? 'Search' ,
150150 route: '/search' ,
151- index : 1 ,
151+ shellIndex : 1 ,
152152 ),
153153 );
154154 }
155155
156- // Adjust indices based on whether search is included
157- final libraryIndex = isOfflineMode ? 1 : 2 ;
158- final settingsIndex = isOfflineMode ? 2 : 3 ;
159-
160156 items.addAll ([
161157 _NavigationItem (
162158 icon: FluentIcons .book_24_regular,
163159 selectedIcon: FluentIcons .book_24_filled,
164160 label: context.l10n? .library ?? 'Library' ,
165161 route: '/library' ,
166- index : libraryIndex ,
162+ shellIndex : 2 ,
167163 ),
168164 _NavigationItem (
169165 icon: FluentIcons .settings_24_regular,
170166 selectedIcon: FluentIcons .settings_24_filled,
171167 label: context.l10n? .settings ?? 'Settings' ,
172168 route: '/settings' ,
173- index : settingsIndex ,
169+ shellIndex : 3 ,
174170 ),
175171 ]);
176172
@@ -231,21 +227,12 @@ class _NavigationItem {
231227 required this .selectedIcon,
232228 required this .label,
233229 required this .route,
234- required this .index ,
230+ required this .shellIndex ,
235231 });
236232
237233 final IconData icon;
238234 final IconData selectedIcon;
239235 final String label;
240236 final String route;
241- final int index;
242-
243- // Shell index maps to the actual StatefulShellRoute branch index
244- int get shellIndex {
245- if (route == '/home' ) return 0 ;
246- if (route == '/search' ) return 1 ;
247- if (route == '/library' ) return 2 ;
248- if (route == '/settings' ) return 3 ;
249- return 0 ;
250- }
237+ final int shellIndex;
251238}
0 commit comments