flutter - Is it necessary to create a new `GoRoute` for each widget which is nested? - Stack Overflow

Could you please to explain if we need to create a new GoRoute for each new navigation item?Let's

Could you please to explain if we need to create a new GoRoute for each new navigation item?

Let's say I have a bottom navigation where I use GoRouter with StatefulShellRoute with major routes like

Dashboard * Users * Accounts

Let's say the user taps on Accounts (=/accounts), then he taps on item and goes deeper to AccountDetailView (=/accounts/1) which contains a button Edit which should direct user to AccountEditView (=/accounts/1/edit). The edit widget can navigate to new routes AccountEditApiKey (=/accounts/1/edit/api) and AccountEditDescription (=/accounts/1/edit/description).

And question is should we create the new GoRoute for each navigation route?

GoRoute(
  path: `/accounts`,
  builder: (...) => Accounts(),
  routes: [
    GoRoute(
      path: `:id`,
      builder: (...) => AccountDetailView(),
      routes: [
        GoRoute(
          path: `edit`,
          builder: (...) => AccountEditView(),
          routes: [
            GoRoute(
              path: `api`,
              builder: (...) => AccountEditApiKeyView(),
              routes: [
              ],
            ),
            GoRoute(
              path: `description`,
              builder: (...) => AccountEditDescriptionView(),
              routes: [
              ],
            ),
            ... potentially other screens
          ],
        ),
      ],
    ),
  ]
),
// other routes for entities

But if I have dozens entities which may have many nested navigation then how big my routing table becomes?

Is it possible to use navigation 1.0 Navigator.push(context, MaterrialPageRoute(...)) and Navigator.pop for navigation items like AccountEditApiKeyView and AccountEditDescriptionView? And how this will work with route restoration?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745267308a4619534.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信