问题
So in Material Design Spec under Onboarding: here
It is specified that:
32sp line height
which is the height from the bottom of the headline text to the base line of the subhead text.
My question is how exactly can this be implemented in flutter. Are padding enough to mimic this spec? or are there other more accurate ways to do this?
回答1:
Yes, there is also a height property in TextStyle which allows you to manually adjust the height of the line.
Code Snippet
Text('Hey There', 
  style: TextStyle(height: 5, fontSize: 10),
)
    回答2:
In addition to Ayush answer. I f we look to the documentation, we can see
When height is non-null, the line height of the span of text will be a multiple of fontSize and be exactly fontSize * height logical pixels tall.
For example, if want to have height 24.0, with font-size 20.0, we should have height property 1,2.
Example:
TextStyle(
      fontSize: 20.0,
      height: 1.2,
);
    来源:https://stackoverflow.com/questions/58156806/how-do-set-text-line-height-in-flutter