PersistentBottomNavBar icon indicating copy to clipboard operation
PersistentBottomNavBar copied to clipboard

Jump to specific tab and navigate to a page

Open rodrigobastosv opened this issue 2 years ago • 2 comments

Hey, first of all thanks for the great package.

When pressing a button, i want to jump to a specific tab and then i want to navigate to a specific route under that tab. I cannot do this right now, since i did not find a way to get the context of the specific tab im jumping to.

My nav bar item is setup this way:

routeAndNavigatorSettings: RouteAndNavigatorSettings(
            onGenerateRoute: AccountRouter.generateRoutes,
            initialRoute: AccountRoutes.accountPage,
            navigatorKey: G<GlobalKey<NavigatorState>>(),
          )

I really though i could get the context by passing my own global key of navigator state. When i tried to navigate getting the context out of G<GlobalKey<NavigatorState>>() the context is null, so i cannot navigate.

I realized that i can get the context of the selected tab by using this selectedTabScreenContext, but i do not know if this is the right path to follow.

rodrigobastosv avatar Jan 04 '23 02:01 rodrigobastosv

Did you find a solution for this ?

quen09t avatar Feb 01 '23 10:02 quen09t

Yes. I had to somehow store all the contexts on my own. And whenever i want to navigate to navigate on the tab i have to pass the right context to it. It's not very elegant. But it's working

rodrigobastosv avatar Mar 28 '23 15:03 rodrigobastosv