0
new ListView(
children: <Widget>[
new RaisedButton(child: const Text('1')),
],
)
如何使按鈕僅佔其自然寬度是多少?
new ListView(
children: <Widget>[
new RaisedButton(child: const Text('1')),
],
)
如何使按鈕僅佔其自然寬度是多少?
考慮將您的RaisedButton
換成。除了讓該按鈕成爲其固有寬度外,還可以使用通過使用構造函數的參數mainAxisAlignment
來水平定位按鈕。例如右對齊按鈕,使用此:
new ListView(
children: <Widget>[
new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
new RaisedButton(
child: const Text('1'),
onPressed:() { /* ... */ },
),
],
),
],
),