在Flutter中创建一个带边框半径的圆形按钮/按钮 [英] Create a rounded button / button with border-radius in Flutter
本文介绍了在Flutter中创建一个带边框半径的圆形按钮/按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在Flutter中开发一个Android应用。如何添加圆形按钮?
I'm currently developing an Android app in Flutter. How can I add a rounded button?
推荐答案
1。解决方案摘要
您可以对 FlatButton $ c使用
shape
$ c>和 RaisedButton
。
You can use shape
for FlatButton
and RaisedButton
.
2。圆形按钮
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red)
),
方形按钮
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0.0),
side: BorderSide(color: Colors.red)
),
完整示例
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red)),
color: Colors.white,
textColor: Colors.red,
padding: EdgeInsets.all(8.0),
onPressed: () {},
child: Text(
"Add to Cart".toUpperCase(),
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 10),
RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red)),
onPressed: () {},
color: Colors.red,
textColor: Colors.white,
child: Text("Buy now".toUpperCase(),
style: TextStyle(fontSize: 14)),
),
],
)
这篇关于在Flutter中创建一个带边框半径的圆形按钮/按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文