【发布时间】:2020-11-22 22:29:34
【问题描述】:
我想在不增加小部件总大小的情况下显示更大的图标,可能只显示图标的一部分。
我该怎么做?
【问题讨论】:
-
请发布您迄今为止尝试过的代码
-
@Mobina 是的。谢谢!
标签: flutter
我想在不增加小部件总大小的情况下显示更大的图标,可能只显示图标的一部分。
我该怎么做?
【问题讨论】:
标签: flutter
How to resizing an Icon / Icon Button in Flutter? 中的答案 帮助了我。
我已使用Transform.scale 对其进行缩放。
return FittedBox(
child: FlatButton(
color: Colors.red,
onPressed: () {},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(45),
),
child: Row(
children: [
Transform.scale(
child: Icon(LetsGoIcons.fighting, color: Colors.white),
scale: 2,
),
SizedBox(width: 10),
Text("Fighting",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
letterSpacing: 0.7,
fontSize: 18))
],
),
)
);
【讨论】:
只需设置 size 属性即可增大尺寸
Icon(Icons.clear, size: 18.0)
【讨论】: