我正在try 创建方形按钮,但展开后的效果似乎与容器不同.以下面的代码为例
new Expanded(
flex: 2,
child: new Column(
children: <Widget>[
new Expanded(
child:new Row(
children: <Widget>[
new Expanded(child: new MaterialButton(...)),
new Expanded(child: new MaterialButton(....)),
new Expanded(child: new Container(color: Colors.red)),
new Expanded(child: new Container(color: Colors.green)),
]
)
)
],
)
)
....
它显示水平展开但不垂直展开的两个按钮.同时,容器将在水平和垂直方向上扩展.如果我执行以下操作,也会产生相同的效果:
new Expanded(
flex: 2,
child: new Column(
children: <Widget>[
new Expanded(
child:new Column(
children: <Widget>[
new Expanded(child: new MaterialButton(...)),
new Expanded(child: new MaterialButton(....)),
new Expanded(child: new Container(color: Colors.red)),
new Expanded(child: new Container(color: Colors.green)),
]
)
)
],
)
)
....
我把行改成了列.按钮会垂直展开,但不会水平展开,而容器会同时展开.
有没有办法让我的按钮扩展到既适合它们的父级又适合它们的父级?