Flutter layout without AppBar

前端 未结 2 1730
梦谈多话
梦谈多话 2021-02-05 18:36

I need a layout without an appbar, so the most obvious approach is to just leave out the appbar tag on the Scaffold but if I do that the content goes u

相关标签:
2条回答
  • 2021-02-05 19:19

    You can get the OS padding with MediaQuery.

    You'd have to replace your

    margin: const EdgeInsets.only(top: 30.0),
    

    by

    margin: MediaQuery.of(context).padding,
    

    Another solution is to wrap your content inside a SafeArea. Which basically does the same thing.

    0 讨论(0)
  • 2021-02-05 19:33

    Wrap your Column with SafeArea

      body: new SafeArea(
          child: new Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: <Widget>[
              new HeaderLayout(),
            ],
          )
      ) ,
    

    SafeArea is a widget that insets its child by sufficient padding to avoid intrusions by the operating system. For example, this will indent the child by enough to avoid the status bar at the top of the screen.

    0 讨论(0)
提交回复
热议问题