How to use a BottomAppBar for navigation in flutter

后端 未结 3 1130
一整个雨季
一整个雨季 2021-02-01 09:13

Im fairly new to flutter, I have created a nice BottomAppBar with a docked FAB however i also want to use this AppBar for page navigation. I\'ve tried it with a BottomNavigatio

3条回答
  •  礼貌的吻别
    2021-02-01 09:43

    The difference between the BottomAppBar and the BottomNavigationBar, is that with the last one, you can set a list of children (pages) to be rendered as you click on the icons below (onTap method). With the BottomAppBar, you have to set a Navigator method, speaking in UI/UX therms, I don't think it's very beauty to see.

    1. Create an auxiliar component, which will have the BottomAppBar.
    2. Then, pass a Row as the child method of it
    3. Fill with your IconButtons
    4. Set the onPressed methods to call the pages (Navigator.of(context).pushName('/yourScreenHere')

    Then, every screen you make you can add an AppBar on them.

提交回复
热议问题