【发布时间】:2020-02-25 01:43:12
【问题描述】:
我在颤动中扩展按钮时遇到问题,我需要将图标对齐到按钮的左侧,我使用小部件 Row 制作它,因为这是我找到的最佳方式。但是,文本没有正确居中。
SizedBox(
width: double.infinity,
child: RaisedButton(
onPressed: () => {},
color: Colors.blue,
textColor: Colors.white,
child: Row(
children: <Widget>[
Icon(Icons.send),
Expanded(
child: Text('Enviar', textAlign: TextAlign.center)
)
],
)
),
),
结果是
有没有更好的方法来制作具有这种样式的按钮(文本在所有按钮中居中,不仅在它的空间中)?
【问题讨论】: