How to make BottomNavigationBar persistent and how to make tabs not reload in Flutter

549

not quite understand the use case of problem 1, but for the second question, use keepalive:

class TestState extends State<Test> with AutomaticKeepAliveClientMixin {
  @override
  bool get wantKeepAlive => true;

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return
  }
}
Share:
549
maxpill
Author by

maxpill

Updated on December 15, 2022

Comments

  • maxpill
    maxpill over 1 year

    SOLVED: Using CuperinoTabScaffold() with CupertinoTabBar() solved both problems.

    Helllo, I have a question about BottomNavigationBar.

    Lets say that I have a BottomNavigationBar with 5 tabs looking like this:

    Home - Map - Messages - Friends - Settings

    And routes:

    **Home -> 
    Map -> 
    Messages -> message_screen
    Friends -> friend_list -> deletefriend_screen
    Settings -> login_screen**
    

    The problem is that, i have no idea how to make the BottomNavigationBar not disappear when i push let say friend_list when i am on friends screen.

    The second question is, that i want to make Home,Map,Messages,Friends,Settings screens persistent, so when i switch tabs from Home to Map or from **Map ->Friends-> friend_list -> back to Map**, map shouldnt reload. But when i go **Friends -> friend_list -> deletefriend_screen _> Settings -> Friends -> friend_list** friend_list should reload. Only the first screens, the tabs should be persistent.

    Thanks for all help :_)

  • maxpill
    maxpill about 4 years
    Thank you :) that solved problem no. 2. The case of problem one is that i want to make BottomNavigationBar persistent, appearing at the bottom of the screen all the time