【发布时间】:2019-07-16 22:46:00
【问题描述】:
我有一个Material 小部件来包装一个MaterialButton 来制作边框半径,但我无法为其设置width 属性。我尝试使用 SizedBox 但不起作用,Material 小部件继续使用屏幕的所有空间。
代码:
return new SizedBox(
width: 40,
child: Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22.0)),
elevation: 18.0,
color: Color(0xFF801E48),
clipBehavior: Clip.antiAlias,
child: MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 30.0,
child: new Text('Sair',
style:
new TextStyle(fontSize: 16.0, color: Colors.white)),
),
),
);
结果:
显然它没有 40.0 的宽度尺寸。
【问题讨论】:
标签: dart flutter widget material-ui flutter-layout