StrutStyle constructor
- String? fontFamily,
- List<
String> ? fontFamilyFallback, - double? fontSize,
- double? height,
- TextLeadingDistribution? leadingDistribution,
- double? leading,
- FontWeight? fontWeight,
- FontStyle? fontStyle,
- bool? forceStrutHeight,
Creates a new StrutStyle object.
-
fontFamily
: The name of the font to use when painting the text (e.g., Roboto). -
fontFamilyFallback
: An ordered list of font family names that will be searched for when the font infontFamily
cannot be found. -
fontSize
: The size of glyphs (in logical pixels) to use when painting the text. -
height
: The minimum height of the line boxes, as a multiplier of the font size. The lines of the paragraph will be at least(height + leading) * fontSize
tall whenfontSize
is not null. Omittingheight
(or setting it to kTextHeightNone) will allow the minimum line height to take the height as defined by the font, which may not be exactly the height of thefontSize
. WhenfontSize
is null, there is no minimum line height. Tall glyphs due to baseline alignment or largeTextStyle.fontSize
may cause the actual line height after layout to be taller than specified here. ThefontSize
must be provided for this property to take effect. -
leading
: The minimum amount of leading between lines as a multiple of the font size.fontSize
must be provided for this property to take effect. The leading added by this property is distributed evenly over and under the text, regardless ofleadingDistribution
. -
leadingDistribution
: how the extra vertical space added by theheight
multiplier should be distributed over and under the text, independent ofleading
(which is always distributed evenly over and under text). Defaults to the paragraph's TextHeightBehavior's leading distribution. -
fontWeight
: The typeface thickness to use when painting the text (e.g., bold). -
fontStyle
: The typeface variant to use when drawing the letters (e.g., italics). -
forceStrutHeight
: When true, the paragraph will force all lines to be exactly(height + leading) * fontSize
tall from baseline to baseline. TextStyle is no longer able to influence the line height, and any tall glyphs may overlap with lines above. If afontFamily
is specified, the total ascent of the first line will be the min of theAscent + half-leading
of thefontFamily
and(height + leading) * fontSize
. Otherwise, it will be determined by the Ascent + half-leading of the first text.
Implementation
StrutStyle({
String? fontFamily,
List<String>? fontFamilyFallback,
double? fontSize,
double? height,
TextLeadingDistribution? leadingDistribution,
double? leading,
FontWeight? fontWeight,
FontStyle? fontStyle,
bool? forceStrutHeight,
}) : _encoded = _encodeStrut(
fontFamily,
fontFamilyFallback,
fontSize,
height,
leadingDistribution,
leading,
fontWeight,
fontStyle,
forceStrutHeight,
),
_leadingDistribution = leadingDistribution,
_fontFamily = fontFamily,
_fontFamilyFallback = fontFamilyFallback;