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

AutoTabsRouter.pageView does not fire NavigatorObserver(s) if moving from higher page index to lower one #2044

Open
Adam-Langley opened this issue Aug 22, 2024 · 0 comments · May be fixed by #2045

Comments

@Adam-Langley
Copy link

I'm using AutoTabsRouter.pageView, with a BottomNavigationBar.

I am listening to the route change to rebuild my BottomNavigationBar, such that it correctly styles tabs to show selection.

One can change pages by either, tapping a tab button, or swiping the pageview left/right.

If using the swipe gesture to change the page, AND changing from a higher page index to a lower one, the AutoTabsRouter does not fire the didChangeTabRoute observers - hence my application is not aware that the app navigation has changed, and I cannot paint the UI to reflect this state.

I guess it doesn't really matter what I'm doing with the observer event, the key is that AutoTabsRouter.pageView doesnt notify observers consistently.

I've tracked this down to auto_tabs_router.dart:524

When "decrementing" the activeIndex, the toInt() on line 520 causes the controllerPage variable to equal the new page index, rather than the intended previous one - hence line 524 evaluates to false, and _didChangeTabRoute() is not called.

I'll have a crack at it - looks like a simple fix, but I may very well be misunderstanding why you truncated the page index variable...

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