-
-
Save tolo/f7e6c30cad3ac76085d75255ba509f10 to your computer and use it in GitHub Desktop.
Here are my 2 cents until the PR adding support for this use case it's merged. If you updated to go_router 6.0.7+ this was introduced:
Use HeroControllerScope for nested Navigator that fixes Hero Widgets not animating in Nested Navigator.
So the above gist won't work until a small change it's made to work with 6.0.7 versions and above.
On the ScaffoldWithNavBar widget inside the BottomTabBarShellRoute the currentNavigator prop can't be casted to Navigator directly because the builder method will not return now a Navigatorbut instead a HeroControllerScope.
So in line 128 this change should be done to make the gist work:
ScaffoldWithNavBar(tabs: tabs, key: scaffoldKey,
currentNavigator: (fauxNav as HeroControllerScope).child as Navigator,
currentRouterState: state, routes: routes),
]);
why in StatefulWidget i call @OverRide
void initState() {
super.initState();
print("-----RUN------ ")}
- At tab:: firstly -----RUN------ call double, but since the 2nd time onwards it only calls 1 time. Please help me :(
Here are my 2 cents until the PR adding support for this use case it's merged. If you updated to go_router 6.0.7+ this was introduced:
Use HeroControllerScope for nested Navigator that fixes Hero Widgets not animating in Nested Navigator.So the above gist won't work until a small change it's made to work with 6.0.7 versions and above. On the
ScaffoldWithNavBarwidget inside theBottomTabBarShellRoutethecurrentNavigatorprop can't be casted toNavigatordirectly because thebuildermethod will not return now aNavigatorbut instead aHeroControllerScope.So in line 128 this change should be done to make the gist work:
ScaffoldWithNavBar(tabs: tabs, key: scaffoldKey, currentNavigator: (fauxNav as HeroControllerScope).child as Navigator, currentRouterState: state, routes: routes), ]);
type '_CustomNavigator' is not a subtype of type 'HeroControllerScope' in type cast
πππ»