如何在Flutter中调整图标/图标按钮的大小? [英] How to resizing an Icon / Icon Button in Flutter?
本文介绍了如何在Flutter中调整图标/图标按钮的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2个问题.
- 如何缩放图标?我的意思是不是Flutter提供的默认图标.但是当您更改为图片时.我有一个带有这样的图像的图标按钮:
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
IconButton(
icon: new Image.asset("images/IG.png"),
),
IconButton(
icon: new Image.asset("images/Twitter.png"),
),
IconButton(
icon: new Image.asset("images/Fb.png"),
),
],
)
只有3个图标.当我添加更多图标时,它会将布局分解为黄黑色的砖块.如何使它们变小?
its only 3 icons. when I add more icon, its gonna break the layout into bricks yellow-black. how to make them become smaller ?
-
上面的问题是针对IconButton的. 如何用图像更改图标? 这是代码:
Question above is for IconButton. how to change an Icon with an Image ? here are the code:
Icon(Icons.star, color: Colors.red)
如何使用Image.asset更改'star
'?
没有引用任何其他链接,仅显示图标.
how to change the 'star
' with Image.asset ?
without any referal to other link, that only show the icon.
推荐答案
您可以将size
属性用于Icon
.
Icon(
Icons.radio_button_checked,
size: 12,
),
对于IconButton
,您可以使用
Transform.scale(
scale: 0.5,
child: IconButton(
onPressed: (){},
icon: new Image.asset("images/IG.png"),
),
),
这篇关于如何在Flutter中调整图标/图标按钮的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文