问题
Consider following application (it's a schematic preview and it may be a bit tricky to understand!):
The app contains 3 screens, which is as follows:
- Screen 1: a simple screen which has a simple content (like a web page content without any specific link to another page).
- Screen 2: a stacked content which you can navigate through widgets with basic Navigator methods such as pop and push.
- Screen 3: a tabbed content, such as bottom navigation bar or tab bar, which has two tabs
a
andb
, which every one of them again has a stacked content.
Note: contents with underlined names are defaults, i.e., Screen3,a,i shows when you open app for the first time.
Problem
We want to navigate through whole of the application content using named routes. Consider contents named as follows:
/
/Screen1
/Screen2/b
/Screen3/a
/Screen3/a/ii
So the following navigation scenarios as examples are expected:
1. /Screen1 <=> /Screen2/a
2. /Screen1/a <=> /Screen3
3. /Screen1/a <=> /Screen3/b
4. /Screen1/a <=> /Screen3/a/iii
5. /Screen2/a <=> /Screen2/c
6. /Screen2/c <=> /Screen3/b
7. /Screen3/a/i <=> /Screen3/b/ii
8. /Screen3/a/i <=> /Screen3/a/iii
Useful Links
Here are some useful and advance tutorials about navigation on flutter.
Flutter Case Study: Multiple Navigators with BottomNavigationBar
Nested navigation with a bottom navigation bar using Flutter
Common bottom navigation bar made easy — Flutter
Bottom Navigation in Flutter: Mastery Guide
Navigator class
Learning Flutter’s new navigation and routing system
Update
Partially implemented of above scenario attached below, help me to complete missed routing buttons.
https://dartpad.dev/1616a3d1a4c06ebd32ef8dd7b77d00d9
来源:https://stackoverflow.com/questions/65277141/flutter-integrated-stacked-and-tabbed-navigations