1

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
  • 1,211
  • 1
  • 11
  • 18

2 Answers2

0

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
  }
}
Jim
  • 6,928
  • 1
  • 7
  • 18
  • 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 – maxpill Mar 31 '20 at 09:31
0

It depends on how you are using it. I might need to see your code to understand what is going on. But you can check if this similar post answers your question:

Flutter: Keep BottomNavigationBar When Push to New Screen with Navigator

Texv
  • 1,225
  • 10
  • 14