简体   繁体   English

有没有办法让颤振小部件不遵守脚手架填充?

[英]Is there a way to make a flutter widget to disobey scaffold padding?

My app screen has a lot of containers and according to the UX design, they're all supposed to be padded within the scaffold.我的应用程序屏幕有很多容器,根据 UX 设计,它们都应该填充在脚手架内。 Now there's one container that has the task of displaying error messages.现在有一个容器负责显示错误消息。 I want just this container to occupy full width ie.我只想这个容器占据全宽,即。 not be padded.不被填充。

Use the widget Stack as the root widget and put your scaffold inside.使用小部件堆栈作为根小部件并将您的脚手架放在里面。 The container bellow will be displayed over the scaffold if it exists.如果存在,下面的容器将显示在脚手架上方。

Stack(
  children: <Widget>[
    Scaffold(
          body:...
    ),  
    Container(
      constraints: BoxConstraints.expand(),
      decoration: BoxDecoration(
        color: Colors.red
      ),
    ),
  ],
),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM