Creates a copy of this text style but with the numeric fields multiplied by the given factors and then incremented by the given deltas.
For example, style.apply(fontSizeFactor: 2.0, fontSizeDelta: 1.0)
would
return a TextStyle whose fontSize is style.fontSize * 2.0 + 1.0
.
For the fontWeight, the delta is applied to the FontWeight enum index
values, so that for instance style.apply(fontWeightDelta: -2)
when
applied to a style
whose fontWeight is FontWeight.w500 will return a
TextStyle with a FontWeight.w300.
The arguments must not be null.
If the underlying values are null, then the corresponding factors and/or deltas must not be specified.
The non-numeric fields can be controlled using the corresponding arguments.
Source
TextStyle apply({ Color color, String fontFamily, double fontSizeFactor: 1.0, double fontSizeDelta: 0.0, int fontWeightDelta: 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, }) { assert(fontSizeFactor != null); assert(fontSizeDelta != null); assert(fontSize != null || (fontSizeFactor == 1.0 && fontSizeDelta == 0.0)); assert(fontWeightDelta != null); assert(fontWeight != null || fontWeightDelta == 0.0); assert(letterSpacingFactor != null); assert(letterSpacingDelta != null); assert(letterSpacing != null || (letterSpacingFactor == 1.0 && letterSpacingDelta == 0.0)); assert(wordSpacingFactor != null); assert(wordSpacingDelta != null); assert(wordSpacing != null || (wordSpacingFactor == 1.0 && wordSpacingDelta == 0.0)); assert(heightFactor != null); assert(heightDelta != null); assert(heightFactor != null || (heightFactor == 1.0 && heightDelta == 0.0)); return new TextStyle( inherit: inherit, color: color ?? this.color, fontFamily: fontFamily ?? this.fontFamily, fontSize: fontSize == null ? null : fontSize * fontSizeFactor + fontSizeDelta, fontWeight: fontWeight == null ? null : FontWeight.values[(fontWeight.index + fontWeightDelta).clamp(0, FontWeight.values.length - 1)], fontStyle: fontStyle, letterSpacing: letterSpacing == null ? null : letterSpacing * letterSpacingFactor + letterSpacingDelta, wordSpacing: wordSpacing == null ? null : wordSpacing * wordSpacingFactor + wordSpacingDelta, textBaseline: textBaseline, height: height == null ? null : height * heightFactor + heightDelta, decoration: decoration, decorationColor: decorationColor, decorationStyle: decorationStyle, ); }