admin管理员组文章数量:1395730
I implemented GoRouter in my application. However, there are 2 issues aries.
- The backstack seems broken, because when i back from 3rd screen it pops to Home
- Bottom navigation was not hidden in the 2nd and 3rd screen.
Please check the video below.
Here is my GoRouter implementation:
StatefulShellRoute.indexedStack(
builder: (context, state, child) {
return BlocProvider(
create: (context) => HomeBloc()..add(GetHomeMenus()),
child: HomePage(
showSuccessSnackbar: false,
child: child,
),
);
},
branches: [
StatefulShellBranch(
routes: [
GoRoute(
name: RouterList.home, // 1st route
path: RouterList.home,
pageBuilder: (context, state) {
return _getDefaultTransition(state.pageKey, DashboardPage());
},
routes: [
GoRoute( // 2nd route
name: RouterList.psychotestSim,
path: RouterList.psychotestSim,
builder: (context, state) {
return BlocProvider(
create: (context) => SimBloc(),
child: SimRegistration(
key: UniqueKey(),
),
);
},
),
GoRoute( // 3rd route
// parentNavigatorKey: _rootNavigatorKey,
name: RouterList.psychotestSimCamera,
path: RouterList.psychotestSimCamera,
builder: (context, state) => Placeholder(
key: UniqueKey(),
),
)
],
)
],
),
StatefulShellBranch(
routes: [
GoRoute(
name: RouterList.profile,
path: RouterList.profile,
pageBuilder: (context, state) {
return _getDefaultTransition(state.pageKey, ProfilePage());
},
)
],
),
StatefulShellBranch(
routes: [
GoRoute(
name: RouterList.result,
path: RouterList.result,
pageBuilder: (context, state) {
return _getDefaultTransition(state.pageKey, Container());
},
),
],
),
],
)
And I navigate to 2nd & 3rd route using context.goNamed(...)
本文标签: flutterGoRouter Shell Route Nested NavigationStack Overflow
版权声明:本文标题:flutter - GoRouter Shell Route Nested Navigation - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744681847a2619458.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论