gpt4 book ai didi

flutter - 无法更改 flutter 中的 Material 图标重量

转载 作者:行者123 更新时间:2023-12-03 07:57:17 24 4
gpt4 key购买 nike

我只是想使用图标属性(权重),我认为这应该不是问题,但它不起作用,希望有人知道如何正确使用它

My code

图标看起来像这样:(我只是想改变线宽)

How it looks

提前致谢!希望不是菜鸟错误哈哈

最佳答案

目前图标的默认字体不支持粗细,因此,除非您为图标导入自定义字体,否则它将无法工作,但是自定义字体有一个解决方法,您可以执行以下操作:

Text(String.fromCharCode(Icons.space_dashboard_outlined.codePoint),
style: TextStyle(
inherit: false,
fontSize: 50,
fontWeight: FontWeight.w800,
fontFamily: Icons.space_dashboard_outlined.fontFamily,
),
)

例如:

     Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(
String.fromCharCode(Icons.space_dashboard_outlined.codePoint),
style: TextStyle(
inherit: false,
fontSize: 50,
fontWeight: FontWeight.w200,
fontFamily: Icons.space_dashboard_outlined.fontFamily,
),
),
Text(
String.fromCharCode(Icons.space_dashboard_outlined.codePoint),
style: TextStyle(
inherit: false,
fontSize: 50,
fontWeight: FontWeight.w500,
fontFamily: Icons.space_dashboard_outlined.fontFamily,
),
),
Text(
String.fromCharCode(Icons.space_dashboard_outlined.codePoint),
style: TextStyle(
inherit: false,
fontSize: 50,
fontWeight: FontWeight.w800,
fontFamily: Icons.space_dashboard_outlined.fontFamily,
),
)
]),

看起来像这样:

enter image description here

关于flutter - 无法更改 flutter 中的 Material 图标重量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75726286/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com