BilalShahid13 / PersistentBottomNavBar

A highly customizable persistent bottom navigation bar for Flutter
BSD 3-Clause "New" or "Revised" License
528 stars 395 forks source link

Jump to specific tab and navigate to a page #321

Open rodrigobastosv opened 1 year ago

rodrigobastosv commented 1 year ago

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.

quen09t commented 1 year ago

Did you find a solution for this ?

rodrigobastosv commented 1 year ago

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