apply method Null safety

TextTheme apply(
  1. {String? fontFamily,
  2. double fontSizeFactor = 1.0,
  3. double fontSizeDelta = 0.0,
  4. Color? displayColor,
  5. Color? bodyColor,
  6. TextDecoration? decoration,
  7. Color? decorationColor,
  8. TextDecorationStyle? decorationStyle}
)

Creates a copy of this text theme but with the given field replaced in each of the individual text styles.

The displayColor is applied to headline4, headline3, headline2, headline1, and caption. The bodyColor is applied to the remaining text styles.

Consider using Typography.black or Typography.white, which implement the typography styles in the material design specification, as a starting point.

Implementation

TextTheme apply({
  String? fontFamily,
  double fontSizeFactor = 1.0,
  double fontSizeDelta = 0.0,
  Color? displayColor,
  Color? bodyColor,
  TextDecoration? decoration,
  Color? decorationColor,
  TextDecorationStyle? decorationStyle,
}) {
  return TextTheme(
    headline1: headline1?.apply(
      color: displayColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    headline2: headline2?.apply(
      color: displayColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    headline3: headline3?.apply(
      color: displayColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    headline4: headline4?.apply(
      color: displayColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    headline5: headline5?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    headline6: headline6?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    subtitle1: subtitle1?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    subtitle2: subtitle2?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    bodyText1: bodyText1?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    bodyText2: bodyText2?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    caption: caption?.apply(
      color: displayColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    button: button?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
    overline: overline?.apply(
      color: bodyColor,
      decoration: decoration,
      decorationColor: decorationColor,
      decorationStyle: decorationStyle,
      fontFamily: fontFamily,
      fontSizeFactor: fontSizeFactor,
      fontSizeDelta: fontSizeDelta,
    ),
  );
}