apply method
TextStyle
apply({
- PdfColor? color,
- Font? font,
- Font? fontNormal,
- Font? fontBold,
- Font? fontItalic,
- Font? fontBoldItalic,
- double fontSizeFactor = 1.0,
- double fontSizeDelta = 0.0,
- double letterSpacingFactor = 1.0,
- double letterSpacingDelta = 0.0,
- double wordSpacingFactor = 1.0,
- double wordSpacingDelta = 0.0,
- double heightFactor = 1.0,
- double heightDelta = 0.0,
- TextDecoration decoration = TextDecoration.none,
Creates a copy of this text style replacing or altering the specified properties.
Implementation
TextStyle apply({
PdfColor? color,
Font? font,
Font? fontNormal,
Font? fontBold,
Font? fontItalic,
Font? fontBoldItalic,
double fontSizeFactor = 1.0,
double fontSizeDelta = 0.0,
double letterSpacingFactor = 1.0,
double letterSpacingDelta = 0.0,
double wordSpacingFactor = 1.0,
double wordSpacingDelta = 0.0,
double heightFactor = 1.0,
double heightDelta = 0.0,
TextDecoration decoration = TextDecoration.none,
}) {
assert(fontSize != null || (fontSizeFactor == 1.0 && fontSizeDelta == 0.0));
assert(letterSpacing != null ||
(letterSpacingFactor == 1.0 && letterSpacingDelta == 0.0));
assert(wordSpacing != null ||
(wordSpacingFactor == 1.0 && wordSpacingDelta == 0.0));
assert(heightFactor == 1.0 && heightDelta == 0.0);
return TextStyle(
inherit: inherit,
color: color ?? this.color,
font: font ?? this.font,
fontNormal: fontNormal ?? this.fontNormal,
fontBold: fontBold ?? this.fontBold,
fontItalic: fontItalic ?? this.fontItalic,
fontBoldItalic: fontBoldItalic ?? this.fontBoldItalic,
fontSize:
fontSize == null ? null : fontSize! * fontSizeFactor + fontSizeDelta,
fontWeight: fontWeight,
fontStyle: fontStyle,
letterSpacing: letterSpacing == null
? null
: letterSpacing! * letterSpacingFactor + letterSpacingDelta,
wordSpacing: wordSpacing == null
? null
: wordSpacing! * wordSpacingFactor + wordSpacingDelta,
height: height == null ? null : height! * heightFactor + heightDelta,
background: background,
decoration: decoration,
);
}