【发布时间】:2020-05-05 07:01:56
【问题描述】:
编辑: 我制作了“I AM”明亮的霓虹绿,但它与按钮颜色混合成深绿色。
我想在覆盖整个屏幕的两个按钮上显示文本,一个上半部分和一个下半部分。我希望文本显示在屏幕中间,覆盖每个按钮的一部分。 这是我的按钮代码:
Widget build(BuildContext context) {
return Scaffold(
body: Align(
alignment: Alignment.center,
child: Column(
children: <Widget>[
Container(
height: (MediaQuery.of(context).size.height) / 2,
width: MediaQuery.of(context).size.width,
child: RaisedButton(
color: Colors.black87,
child: poorText,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SecondRoute()),
);
},
),
),
Container(
height: (MediaQuery.of(context).size.height) / 2,
width: MediaQuery.of(context).size.width,
child: RaisedButton(
color: Colors.black87,
child: richText,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ThirdRoute()),
);
},
),
),
],
),
),
);}
我尝试使用堆栈,但它说使用了太多位置参数。如何在按钮上保留列布局和图层文本?如果还有另一种没有列的方法仍然允许使按钮工作,那也很好。谢谢!
【问题讨论】:
标签: flutter dart flutter-layout