Need a persistent/same Bottom Navigation Bar for all screens - Flutter

前端 未结 9 1096
不思量自难忘°
不思量自难忘° 2021-02-01 21:50

I am a beginner with flutter and dart. I have been trying to implement a navigationBar on three different pages in my app. The toggling works well for an individual

9条回答
  •  孤城傲影
    2021-02-01 22:03

    You can use IndexedStack to persist State when you touch/change the page

    Scaffold(
      body: SafeArea(
        top: false,
        child: IndexedStack(
          //Permet de garder le state des vues même quand on change de vue
          index: _currentIndex,
          children: _children,
        ),
      ),
      bottomNavigationBar: BottomNavigationBar( items: [ ] ),
    );
    

提交回复
热议问题