Aug*_*sto 1 widget dart material-ui flutter
我正在尝试将圆角边框设置为我的圆角边框MaterialButton,要设置RoundedRectangleBorder形状属性的MaterialButton,问题是它没有效果。
码:
Widget _showNeedHelpButton() {
return new Padding(
padding: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 0.0),
child: new MaterialButton(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20.0))),
elevation: 5.0,
minWidth: 200.0,
height: 35,
color: Color(0xFF801E48),
child: new Text('Preciso de ajuda',
style: new TextStyle(fontSize: 16.0, color: Colors.white)),
onPressed: () {
setState(() {
_isNeedHelp = true;
});
},
),
);
}
Run Code Online (Sandbox Code Playgroud)
结果:
MaterialButton(
child: Text('My Button'),
height: 40,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
)
Run Code Online (Sandbox Code Playgroud)
RoundedRectangleBorder 会帮助你https://api.flutter.dev/flutter/painting/RoundedRectangleBorder-class.html
如果需要使用MaterialButton()-您需要使用MaterialWidget 扭曲按钮以获得所需的行为。
Widget _showNeedHelpButton() {
return Padding(
padding: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 0.0),
child: Material( //Wrap with Material
shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(22.0) ),
elevation: 18.0,
color: Color(0xFF801E48),
clipBehavior: Clip.antiAlias, // Add This
child: MaterialButton(
minWidth: 200.0,
height: 35,
color: Color(0xFF801E48),
child: new Text('Preciso de ajuda',
style: new TextStyle(fontSize: 16.0, color: Colors.white)),
onPressed: () {
// setState(() {
// _isNeedHelp = true;
// });
},
),
),
);
}
Run Code Online (Sandbox Code Playgroud)
更新:
minWidth: 200.0,
height: 95,
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3051 次 |
| 最近记录: |