Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing detection issue #2

Open
rebazjabar opened this issue Mar 23, 2024 · 1 comment
Open

Routing detection issue #2

rebazjabar opened this issue Mar 23, 2024 · 1 comment

Comments

@rebazjabar
Copy link

Hello Dear
when i try click the button to navigate to new Page i use
GoRouter.of(Utils.tabNav.currentContext!).go('/rooms');
the function is work it navigate to the route it show the new destination page but the Icon on the BottomBar will not swap to new page it remain on the selected icon , please how to fix that ?

@romanejaquez
Copy link
Owner

hey @rebazjabar so you're trying to perform the navigation away from the navigation bar (i.e. using GoRouter in another context). If you want to navigate to the Rooms Page while at the same time update the bottom bar icon so it changes, you must mark the item as selected in the bottom bar programmatically. I just updated the code and added a new method in the BottomBarViewModel:

markBottomBarItemSelectedByRoute(String route)

So you should do it like this now:

First, navigate to your page:

GoRouter.of(Utils.tabNav.currentContext!).go('/rooms') => you should say also instead go(RoomsPage.route).

Then, update the bottom bar item with the same route:

ref.read(bottomBarVMProvider.notifier).markBottomBarItemSelectedByRoute(RoomsPage.route);

And you should be good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants