flutter - 如何减少 raisebutton.icon 小部件中图标和文本之间的空间?
问题描述
我想减少凸起按钮内的图标和文本之间存在的空间
这是我试图做的:
RaisedButton.icon(onPressed: (){
(product.hasAbonnement=false) ?
Navigator.push(context,
MaterialPageRoute(builder: (context) => ProductDetailPage(
product: product,
viewModel: widget.viewModel,),
))
:
Navigator.push(context,
MaterialPageRoute(builder: (context) => SubcriptionDetailPage(
product: product,
viewModel: widget.viewModel,),
));
}, icon: Icon(Icons.add,color: Colors.white), label:Text('S\'abonner',
style:TextStyle(color:Colors.white,
)
,),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
color:mmpataColorBlue,
),
解决方案
这是解决方案,因为Hiwa Jalal给出了正确的答案,只需要一点操作。干得好:
Center(
child: RaisedButton(
color: Colors.blue,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(Icons.add, color: Colors.white),
Text('S\'abonner', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold))
]
),
onPressed: () {}
)
)
输出:
推荐阅读
- go - 如何调试在 IntelliJ 中返回多个值的 Go 函数?
- python - 用于复杂字符串的正则表达式
- java - 升级球衣 2.25.1 2.32 后,AbstractBinder 无法正常工作
- apache-spark - Databricks spark数据框按每列创建数据框
- java - java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTWorkbook$Factory + spring
- amazon-cognito - AWS Cognito:管理员重置密码发送邮件(使用 OTP),但是当用户尝试登录时,他们必须再次重置密码并使用 OTP 再收到一封邮件
- javascript - 如果内部对象为空,则删除对象数组
- load-testing - 让 Locust 每秒发送预定义的请求分布
- tensorflow - 量化意识训练比量化后差
- python - 在 for 循环中为字典重复值