applyTo method

TextStyle applyTo(
  1. TextStyle base
)

base with this style's typography applied.

Colours other than color are painted by InlineCodeDecoration, not carried on the TextStyle — that is what lets the chip have a radius, an outline and padding while the text still wraps.

Implementation

TextStyle applyTo(TextStyle base) {
  final family = fontFamily;
  final package = fontFamilyPackage;
  final baseSize = base.fontSize;
  final factor = fontSizeFactor;
  return base.copyWith(
    fontFamily:
        family == null || package == null
            ? family
            : 'packages/$package/$family',
    fontFamilyFallback: fontFamilyFallback,
    fontSize:
        baseSize == null || factor == null ? baseSize : baseSize * factor,
    fontWeight: fontWeight,
    color: color,
    // A stale background Paint from the caller's style would double-paint
    // under the chip.
    background: null,
  );
}