在颤动中设置字体粗细时,我通常使用预设值,如FontWeight.normal
或FontWeight.w500
。在我目前的情况下,我需要设置一个自定义的FontWeight。如何将字体粗细设置为350 (书本)?也许有一个我不知道的构造函数。
它看起来像这样:
Text(
'some text',
style: TextStyle(
fontWeight: FontWeight.w300, //but instead of 300 it's 350
)
)
谢谢!
发布于 2020-08-10 11:24:50
FontWeight是一个常量参数。所有字体粗细的列表。const w100,w200,w300,w400,w500,w600,w700,w800,w900
您可以结合使用fontStyle:FontStyle.bold和FontWeight.w200,
试一试吧。如果它起作用了,请告诉我。
发布于 2020-08-10 09:23:50
Text(
'some text',
style: TextStyle(
fontWeight: FontWeight.lerp(FontWeight.w300, FontWeight.w400, 0.5), //but instead of 300 it's 350
)
)
https://stackoverflow.com/questions/63332563
复制相似问题