I have a login page, and after login homepage basically. The homepage has BottomNavigationBar
, like Instagram, and It’s obvious that it’s not GoRoute
, instead of this it’s ShellRoute
. So, ShellRoute
has a key
, but it has not path
parameter, and because of this I can not use context
. go or push methods.
I supposed that ShellRoute
has a path
but it’s not.
3
Answers
You can follow the sample code here , and after the GoRouter settings, you don’t need the ShellRoute’s path.
After login, you just context.go(‘YOUR BottomNavigationBar’s FIRST PAGE’).
In the sample code, just use context.go(‘/a’) and everything will work well!
You should
After doing these, you will understand why you don’t need to add "path" parameter to your ShellRoute.
You can use
context.go('/discover')
in your ScaffoldWithNavBar() widget, when user tap the one of the bottom navigation bar item.Things to keep in mind while using
context.go()
fromShellRoute
toGoRoute
parentNavigatorKey
prop in eachGoRoute
context.go()
to replace page ,context.push()
to push page to stackCode Structure to follow:
Refer detailed code and explaination of bottom NavigationBar using
ShellRoute
andGoRouter
here