1

Consider following application (it's a schematic preview and it may be a bit tricky to understand!):

enter image description here

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 and b, 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

Siamak S
  • 163
  • 9
  • What is your question? Don't know how to navigate? – John Joe Dec 13 '20 at 15:24
  • In general: `We want to navigate through whole of the application content using named routes.` But if I want to ask finer questions, these are some of them: 1. How we can navigate from the `/Screen3/a/i` to `/Screen3/b/ii` using named routes (not index of tabs), and what about pop behavior? 2. How we can navigate from `/Screen1` to a content on one of tabs? (such as `/Screen3/b/ii` for e.g) In general, I want an implementation which supports top 8 mentioned navigation scenarios. – Siamak S Dec 13 '20 at 15:36
  • Can't use `Navigator.pushNamed()` ? – John Joe Dec 13 '20 at 16:04
  • At least we have 4 Navigator on above scenario, call `pushNamed() ` on which one? - Root Navigator, - Navigator for Screen 2 - Navigator for `a` tab of Screen 3 - Navigator for `b` tab of Screen 3 - and maybe a custom Navigator for switching between Screen 3 tabs – Siamak S Dec 13 '20 at 16:15
  • a sample source code attached to the question – Siamak S Dec 13 '20 at 20:54

0 Answers0