StrutStyle constructor
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
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. -
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,
double leading,
FontWeight fontWeight,
FontStyle fontStyle,
bool forceStrutHeight,
}) : _encoded = _encodeStrut(
fontFamily,
fontFamilyFallback,
fontSize,
height,
leading,
fontWeight,
fontStyle,
forceStrutHeight,
),
_fontFamily = fontFamily,
_fontFamilyFallback = fontFamilyFallback;