Last active
March 23, 2024 07:49
-
-
Save tolo/f7e6c30cad3ac76085d75255ba509f10 to your computer and use it in GitHub Desktop.
Example showing how to use go_router to build persistent nested navigation (i.e. separate nested navigation trees) with a BottomNavigationBar.
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 theBottomTabBarShellRoute
thecurrentNavigator
prop can't be casted toNavigator
directly because thebuilder
method will not return now aNavigator
but 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why in StatefulWidget i call @OverRide
void initState() {
super.initState();
print("-----RUN------ ")}