Flutter: Keep BottomNavigationBar When Push to New Screen with Navigator

后端 未结 10 725
情深已故
情深已故 2020-12-25 12:55

In iOS, we have a UITabBarController which stays permanently at the bottom of the screen when we push to a new ViewController.

In Flutter, we have a bottomNavigation

10条回答
  •  执念已碎
    2020-12-25 13:33

    Another way to achieve this (though not good practice) is to nest a material app in the body of your scaffold. And handle all "sub-navigation" there.

    So, your hierarchy will look like this

    Material App
      - home
         - Scaffold
           - body
             - Material App
                  - Scaffold
                      - AppBar
                      - body
                      ...
             - routes (internal)
           - bottomNavigationBar
      - routes (external)
    

    I've tried this and it works perfectly. Unfortunately I can't post the source code now.

提交回复
热议问题