bizz84 / nested-navigation-demo-flutter

Nested navigation with BottomNavigationBar
https://codewithandrea.com/
MIT License
622 stars 139 forks source link

How to switch to another tab dynamically? #19

Open iqtedar123 opened 3 years ago

iqtedar123 commented 3 years ago

Lets say I have three tabs: Tab 1, 2, 3. And I am in tab 2. How can I switch over to Tab 3?

haithambassam commented 2 years ago

There is a state variable in the example _currentTab, you can change this variable to the tap number you want to be selected, but remember you have to put this into setState((){ _currentTab = TabItem.values[2] })

arbazadam commented 2 years ago

What if i want to visit a nested route within that other tab. Say for example a Route on tab 2? From Tab 1? Also, what should be done in the case where i dont need to preserve the state of my visited tab. Issue #21 @haithambassam @bizz84