Reputation: 775
When setting font weights in Flutter I usually use preset values such as FontWeight.normal
or FontWeight.w500
. In my current situation I need to set a custom FontWeight. How can I set the font weight to 350 (Book)? Maybe there is a constructor I don't know about.
It would look something like this:
Text(
'some text',
style: TextStyle(
fontWeight: FontWeight.w300, //but instead of 300 it's 350
)
)
Thanks!
Upvotes: 3
Views: 9520
Reputation: 64
FontWeight is a const parameter. A list of all the font weights. const [w100, w200, w300, w400, w500, w600, w700, w800, w900]
You could use FontWeight.w200 along with fontStyle:FontStyle.bold,
Just give it a try. Let me know if it works.
Upvotes: 1
Reputation: 854
Text(
'some text',
style: TextStyle(
fontWeight: FontWeight.lerp(FontWeight.w300, FontWeight.w400, 0.5), //but instead of 300 it's 350
)
)
Upvotes: 3