我想要得到这个结构:
-----------------------------------------------------------------------------------
item 1 item 2
item 3 item 4
-----------------------------------------------------------------------------------
基本上我需要一个有两个列和每个列中有两个行的表格,但这是我得到的效果:
![](https://istack.dev59.com/ZPHV9.webp)
这是我的代码:
new Container(
decoration: new BoxDecoration(color: Colors.grey),
child: new Row(
children: <Widget>[
new Column(
children: <Widget>[
new Container(
decoration: new BoxDecoration(color: Colors.red),
child: new Text("item 1"),
),
new Container(
decoration: new BoxDecoration(color: Colors.amber),
child: new Text("item 3"),
),
],
),
new Column(
children: <Widget>[
new Container(
decoration: new BoxDecoration(color: Colors.green),
child: new Text("item 2"),
),
new Container(
decoration: new BoxDecoration(color: Colors.teal),
child: new Text("item 4"),
)
],
)
],
),
)
我希望每个 列
占据可用 宽度
的一半。
在 Android
上,我会使用 weight
属性就可以了。
Expanded
上都设置flex: 2
?它们会互相抵消。 - Rémi Rousselet