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 infontFamilycannot 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) * fontSizetall whenfontSizeis not null. Omittingheightwill allow the minimum line height to take the height as defined by the font, which may not be exactly the height of thefontSize. WhenfontSizeis null, there is no minimum line height. Tall glyphs due to baseline alignment or largeTextStyle.fontSizemay cause the actual line height after layout to be taller than specified here. ThefontSizemust be provided for this property to take effect. -
leading: The minimum amount of leading between lines as a multiple of the font size.fontSizemust 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) * fontSizetall from baseline to baseline. TextStyle is no longer able to influence the line height, and any tall glyphs may overlap with lines above. If afontFamilyis specified, the total ascent of the first line will be the min of theAscent + half-leadingof thefontFamilyand(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;