[英]Flutter go_router: how to use ShellRoute with an expanded child?
[英]Flutter: go_router 6.0.1 KEYCODE_BACK throw null safety error in ShellRoute
我的問題的解決方案是重做底部導航,如示例所示:
https://github.com/flutter/packages/blob/main/packages/go_router/example/lib/shell_route.dart
ShellRoute(
navigatorKey: _shellNavigatorKey,
builder: (BuildContext context, GoRouterState state, Widget child) {
return ScaffoldWithNavBar(child: child);
},
....
需要在ShellRoute內部傳一個child,在里面解決不行否則傳不上context。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.