我正在尝试按照 Flutter 中的图像进行布局,但我不知道如何创建具有两种颜色和重叠按钮的背景。
我不知道是否有一个小部件能够做到这一点或需要一些代码......
任何建议或帮助都会很棒! (这是我的第一篇文章,如有不对之处,请见谅!!)
谢谢。
最佳答案
做这样的事情。
body: Stack(
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 300,
color: Colors.grey,
),
],
),
Positioned(
top: 280,
left: 50,
right: 50,
child: RaisedButton(
color: Colors.white,
child: Text("Your Button"),
onPressed: () {},
),
)
],
),
你会得到
让我知道它是否有效
关于flutter - 如何在 Flutter 中创建具有 2 种不同颜色的布局背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62137938/