apply method

TextStyle apply({
  1. PdfColor? color,
  2. Font? font,
  3. Font? fontNormal,
  4. Font? fontBold,
  5. Font? fontItalic,
  6. Font? fontBoldItalic,
  7. double fontSizeFactor = 1.0,
  8. double fontSizeDelta = 0.0,
  9. double letterSpacingFactor = 1.0,
  10. double letterSpacingDelta = 0.0,
  11. double wordSpacingFactor = 1.0,
  12. double wordSpacingDelta = 0.0,
  13. double heightFactor = 1.0,
  14. double heightDelta = 0.0,
  15. 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,
  );
}