The*_*hat 2 flutter flutter-layout
我正在尝试将列内的小部件与CrossAxisAlignment.center对齐在中心,但我也希望这些小部件具有相同的宽度。我该如何实现?
Rao*_*che 10
您可以通过将设置CrossAxisAlignment为Stretch然后将包裹Column在IntrinsicWidth,如果您想给它们指定特定宽度,请使用stepWidth属性
Center(
child: IntrinsicWidth(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RaisedButton(
child: Text("hello"),
onPressed: () {},
),
RaisedButton(
child: Text("another hello"),
onPressed: () {},
),
RaisedButton(
child: Text("DB"),
onPressed: () {},
),
],
),
),
),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1457 次 |
| 最近记录: |