Flutter: Keep BottomNavigationBar When Push to New Screen with Navigator

后端 未结 10 720
情深已故
情深已故 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:46

    tl;dr: Use CupertinoTabBar with CupertinoTabScaffold

    The problem is not in Flutter but in UX just like Rémi Rousselet has mentioned.

    It turned out Material Design doesn't recommend sub-pages in the hierarchy to access the Bottom navigation bar.

    However, iOS Human Interface Guide recommend this. So, to use this feature, I had to adapt Cupertino widgets instead of Material ones. Specifically, in main, return a WidgetsApp/MaterialApp which contains a CupertinoTabScaffold. Implement the tab bar with a CupertinoTabBar and each screen is a CupertinoTabView.

提交回复
热议问题