ButtonsOffset
时间: 2023-08-03 18:15:07 浏览: 38
如果你想在一行中添加多个带有间距的按钮,可以使用 `ButtonBar` 组件或者在 `Row` 中使用 `SizedBox` 组件来设置按钮之间的间距。例如,在 `ButtonBar` 中添加按钮可以通过设置 `ButtonBar` 组件的 `buttonMargin` 来设置按钮之间的间距,如下所示:
```dart
ButtonBar(
buttonMargin: EdgeInsets.symmetric(horizontal: 10.0),
children: <Widget>[
RaisedButton(
child: Text('Button 1'),
onPressed: () {},
),
RaisedButton(
child: Text('Button 2'),
onPressed: () {},
),
RaisedButton(
child: Text('Button 3'),
onPressed: () {},
),
],
)
```
这将在一行中添加三个按钮,并在按钮之间添加 10 像素的间距。你可以根据需要更改 `buttonMargin` 的值。
另外,在 `Row` 中使用 `SizedBox` 组件也可以设置按钮之间的间距。例如:
```dart
Row(
children: <Widget>[
RaisedButton(
child: Text('Button 1'),
onPressed: () {},
),
SizedBox(width: 10.0),
RaisedButton(
child: Text('Button 2'),
onPressed: () {},
),
SizedBox(width: 10.0),
RaisedButton(
child: Text('Button 3'),
onPressed: () {},
),
],
)
```
这将在一行中添加三个按钮,并在按钮之间添加 10 像素的间距。你可以根据需要更改 `SizedBox` 的 `width` 属性的值。