auto_route_library
auto_route_library copied to clipboard
How to clear sub-stack when changing between tabs?
I'vs got 4 tabs with the relative nested page. What i'm trying to accomplish is:
- navigatin to a subpage of Tab1
- switching to Tab2 through the bottomBar
- navigating again on Tab1 -> HERE i would like to see the root page of tab1 instead the one of the step1
is it possible?
Ok, i manage to handle it with:
onTap: (index) { tabsRouter.stackRouterOfIndex(index)?.popUntilRoot(); tabsRouter.setActiveIndex(index); },
but app show for a microsecond the page popped, is the rea method to avoid it?
Probably a bit late, but you can change to pop on exit instead of entry
onTap: (index) { tabsRouter.stackRouterOfIndex(tabsRouter.activeIndex)?.popUntilRoot(); tabsRouter.setActiveIndex(index); },
Also, you might want to change order and to tabsRouter.setActiveIndex(index);
first to make sure you don't see the hidden route popping
onTap: (index) { oldIndex = tabsRouter.activeIndex; tabsRouter.setActiveIndex(index); tabsRouter.stackRouterOfIndex(oldIndex)?.popUntilRoot(); },
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions