Skip to content

Commit bbcf16e

Browse files
committed
fix(navigation): correct router branch order
Swaps the `StatefulShellBranch` for Content Management and User Management in `router.dart`. This aligns the router's branch indices with the visual order of the `NavigationDestination` widgets in the `AppShell`, fixing a bug where clicking a sidebar item would navigate to the wrong page.
1 parent 8279722 commit bbcf16e

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

lib/router/router.dart

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -173,40 +173,6 @@ GoRouter createRouter({
173173
),
174174
],
175175
),
176-
StatefulShellBranch(
177-
routes: [
178-
GoRoute(
179-
path: Routes.userManagement,
180-
name: Routes.userManagementName,
181-
builder: (context, state) => const UserManagementPage(),
182-
routes: [
183-
// Route for the UserFilterDialog.
184-
GoRoute(
185-
path: Routes.userFilterDialog,
186-
name: Routes.userFilterDialogName,
187-
pageBuilder: (context, state) {
188-
final args = state.extra! as Map<String, dynamic>;
189-
final userFilterState =
190-
args['userFilterState'] as UserFilterState;
191-
192-
return MaterialPage(
193-
fullscreenDialog: true,
194-
child: BlocProvider<UserFilterDialogBloc>(
195-
create: (providerContext) =>
196-
UserFilterDialogBloc()..add(
197-
UserFilterDialogInitialized(
198-
userFilterState: userFilterState,
199-
),
200-
),
201-
child: const UserFilterDialog(),
202-
),
203-
);
204-
},
205-
),
206-
],
207-
),
208-
],
209-
),
210176
StatefulShellBranch(
211177
routes: [
212178
GoRoute(
@@ -331,6 +297,40 @@ GoRouter createRouter({
331297
),
332298
],
333299
),
300+
StatefulShellBranch(
301+
routes: [
302+
GoRoute(
303+
path: Routes.userManagement,
304+
name: Routes.userManagementName,
305+
builder: (context, state) => const UserManagementPage(),
306+
routes: [
307+
// Route for the UserFilterDialog.
308+
GoRoute(
309+
path: Routes.userFilterDialog,
310+
name: Routes.userFilterDialogName,
311+
pageBuilder: (context, state) {
312+
final args = state.extra! as Map<String, dynamic>;
313+
final userFilterState =
314+
args['userFilterState'] as UserFilterState;
315+
316+
return MaterialPage(
317+
fullscreenDialog: true,
318+
child: BlocProvider<UserFilterDialogBloc>(
319+
create: (providerContext) =>
320+
UserFilterDialogBloc()..add(
321+
UserFilterDialogInitialized(
322+
userFilterState: userFilterState,
323+
),
324+
),
325+
child: const UserFilterDialog(),
326+
),
327+
);
328+
},
329+
),
330+
],
331+
),
332+
],
333+
),
334334
StatefulShellBranch(
335335
routes: [
336336
GoRoute(

0 commit comments

Comments
 (0)