[英]How to achieve rounded corners on new OutlinedButton widget in Flutter?
[英]Flutter- Adding Padding to OutlinedButton widget
我在为 OutlinedButton 添加焊盘时遇到问题,我一直在使用 OutlineButton,但我决定使用 OutlinedButton,因为该按钮已折旧。 但是,在未定义填充参数的情况下,按钮的用法有所不同。 我尝试将 OutlinedButton 包装在 ButtonTheme 中,但它没有任何效果,现在我正在使用 Padding,如下面的代码示例所示。
new Column(children: [
new Row(children: [
//5th row
new Expanded(
child: Padding(
child: new OutlinedButton(
child: new Text(
"Main Page",
style: TextStyle(
fontFamily: 'NotoSans',
fontSize: 20.0,
fontWeight: FontWeight.w400),
),
onPressed: () {
Navigator.of(context).push(_gotoMainPage());
},
padding: EdgeInsets.all(20),
)),
)
]),
])
],
),
提前致谢。
OutlinedButton 和 ElevatedButton 都有一个styleFrom方法,可用于设置填充、颜色和形状等内容:
OutlinedButton(
child: Text('Padded Button'),
onPressed: (){
},
style: OutlinedButton.styleFrom(
padding: EdgeInsets.all(8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)
)
),
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.