How to display body under the AppBar of scaffold widget and not below?

后端 未结 7 1682
谎友^
谎友^ 2021-02-03 20:16

I\'m using a transparent AppBar and I would like to display body behind the transparent AppBar and not bellow. How to do that ?

7条回答
  •  执笔经年
    2021-02-03 20:50

    To extend the scaffold body behind the top AppBar, add this to your scaffold:

    extendBodyBehindAppBar: true,
    

    To extend the scaffold body behind the BottomNavigationBar or BottomAppBar (which would improve the UI's appearance when you have a docked FloatingActionButton), add this to your scaffold:

    extendBody: true,
    

    As you can see in my example, this causes the body to extend to the very bottom of the screen so you'll need to make sure you add spacing so the BottomAppBar doesn't hide UI features.

提交回复
热议问题