带有flutter go路由器的导航组件
我有这个布局。
我的Go路由器代码:
final appRouter = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
path: '/',
builder: (context, state) => HomePage(key: state.pageKey),
routes: [
GoRoute(
path: 'dashboard',
builder: (context, state) => DashboardPage(),
),
GoRoute(
path: 'audit',
builder: (context, state) => const AuditPage(),
),
]),
],
errorPageBuilder: (context, state) => MaterialPage(
key: state.pageKey,
child: Scaffold(
body: Center(
child: Text(state.error.toString()),
),
),
),
);
如果我想要正常的导航,我该怎么办。 因此,当我选择每个菜单时,它将用屏幕代替绿色面板。使用状态可能很容易。但是可以与Go Router一起使用。我看到嵌套导航文档。它令人困惑。
Autoroute软件包中提供了类似的东西。
I have this layout.
my go router code:
final appRouter = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
path: '/',
builder: (context, state) => HomePage(key: state.pageKey),
routes: [
GoRoute(
path: 'dashboard',
builder: (context, state) => DashboardPage(),
),
GoRoute(
path: 'audit',
builder: (context, state) => const AuditPage(),
),
]),
],
errorPageBuilder: (context, state) => MaterialPage(
key: state.pageKey,
child: Scaffold(
body: Center(
child: Text(state.error.toString()),
),
),
),
);
How can I do if I want normal navigation just like bottom navigation or tab navitation.
So, when I select each menu, it replaces the green panel with the screen. It may be simple to use state with condition. but it is possible to use with go router. I see nested navigation documentation. Its abit confusing.
There is something like this provided in AutoRoute package.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)