Advertisement
Guest User

GoRouter problem

a guest
May 16th, 2025
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 4.31 KB | None | 0 0
  1.  GoRoute(
  2.      path: AppRoutes.issues.toPath,
  3.      name: AppRoutes.issues.toName,
  4.      builder: (_, __) => const IssuesView(),
  5.      routes: [
  6.          // issue details
  7.          StatefulShellRoute.indexedStack(
  8.              branches: [
  9.                  StatefulShellBranch(
  10.                      routes: [
  11.                          GoRoute(
  12.                              path: 'details',
  13.                              redirect: (_, state) => state.namedLocation(
  14.                                  'ISSUE_DETAILS',
  15.                                  pathParameters: state.pathParameters,
  16.                                  queryParameters: state.uri.queryParameters,
  17.                              ),
  18.                          ),
  19.                          GoRoute(
  20.                              path: ':issueId/details',
  21.                              name: 'ISSUE_DETAILS',
  22.                              pageBuilder: (_, state) {
  23.                                  return const NoTransitionPage(
  24.                                      child: IssueDetailsView(),
  25.                                  );
  26.                              },
  27.                          ),
  28.                      ],
  29.                  ),
  30.                  StatefulShellBranch(
  31.                      routes: [
  32.                          GoRoute(
  33.                              path: 'logs',
  34.                              redirect: (_, state) => state.namedLocation(
  35.                                  'ISSUE_DETAILS_LOGS',
  36.                                  pathParameters: state.pathParameters,
  37.                                  queryParameters: state.uri.queryParameters,
  38.                              ),
  39.                          ),
  40.                          GoRoute(
  41.                              path: ':issueId/logs',
  42.                              name: 'ISSUE_DETAILS_LOGS',
  43.                              pageBuilder: (_, state) {
  44.                                  return const NoTransitionPage(
  45.                                      child: IssueLogsView(),
  46.                                  );
  47.                              },
  48.                          ),
  49.                      ],
  50.                  ),
  51.                  StatefulShellBranch(
  52.                      routes: [
  53.                          GoRoute(
  54.                              path: 'checklist',
  55.                              redirect: (_, state) => state.namedLocation(
  56.                                  'ISSUE_DETAILS_CHECKLIST',
  57.                                  pathParameters: state.pathParameters,
  58.                                  queryParameters: state.uri.queryParameters,
  59.                              ),
  60.                          ),
  61.                          GoRoute(
  62.                              path: 'checklist',
  63.                              name: 'ISSUE_DETAILS_CHECKLIST',
  64.                              pageBuilder: (_, state) {
  65.                                  return const NoTransitionPage(
  66.                                      child: IssueCheckListView(),
  67.                                  );
  68.                              },
  69.                          ),
  70.                      ],
  71.                  ),
  72.                  StatefulShellBranch(
  73.                      routes: [
  74.                          GoRoute(
  75.                              path: 'chat',
  76.                              redirect: (_, state) => state.namedLocation(
  77.                                  'ISSUE_DETAILS_CHAT',
  78.                                  pathParameters: state.pathParameters,
  79.                                  queryParameters: state.uri.queryParameters,
  80.                              ),
  81.                          ),
  82.                          GoRoute(
  83.                              path: 'chat',
  84.                              name: 'ISSUE_DETAILS_CHAT',
  85.                              pageBuilder: (_, state) {
  86.                                  return const NoTransitionPage(
  87.                                      child: ChatView(),
  88.                                  );
  89.                              },
  90.                          ),
  91.                      ],
  92.                  ),
  93.              ],
  94.              builder: (_, state, navigationShell) {
  95.                  // argument parsing
  96.  
  97.                  return IssuePage(
  98.                      issueId: issueId,
  99.                      navigationShell: navigationShell,
  100.                  );
  101.              },
  102.          ),
  103.      ],
  104.  ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement