TextStyle constructor

const TextStyle({
  1. bool inherit = true,
  2. Color? color,
  3. Color? backgroundColor,
  4. double? fontSize,
  5. FontWeight? fontWeight,
  6. FontStyle? fontStyle,
  7. double? letterSpacing,
  8. double? wordSpacing,
  9. TextBaseline? textBaseline,
  10. double? height,
  11. TextLeadingDistribution? leadingDistribution,
  12. Locale? locale,
  13. Paint? foreground,
  14. Paint? background,
  15. List<Shadow>? shadows,
  16. List<FontFeature>? fontFeatures,
  17. List<FontVariation>? fontVariations,
  18. TextDecoration? decoration,
  19. Color? decorationColor,
  20. TextDecorationStyle? decorationStyle,
  21. double? decorationThickness,
  22. String? debugLabel,
  23. String? fontFamily,
  24. List<String>? fontFamilyFallback,
  25. String? package,
  26. TextOverflow? overflow,
})

Creates a text style.

The package argument must be non-null if the font family is defined in a package. It is combined with the fontFamily argument to set the fontFamily property.

On Apple devices the strings 'CupertinoSystemText' and 'CupertinoSystemDisplay' are used in fontFamily as proxies for the Apple system fonts. They currently redirect to the equivalent of SF Pro Text and SF Pro Display respectively. 'CupertinoSystemText' is designed for fonts below 20 point size, and 'CupertinoSystemDisplay' is recommended for sizes 20 and above. When used on non-Apple platforms, these strings will return the regular fallback font family instead.

Implementation

const TextStyle({
  this.inherit = true,
  this.color,
  this.backgroundColor,
  this.fontSize,
  this.fontWeight,
  this.fontStyle,
  this.letterSpacing,
  this.wordSpacing,
  this.textBaseline,
  this.height,
  this.leadingDistribution,
  this.locale,
  this.foreground,
  this.background,
  this.shadows,
  this.fontFeatures,
  this.fontVariations,
  this.decoration,
  this.decorationColor,
  this.decorationStyle,
  this.decorationThickness,
  this.debugLabel,
  String? fontFamily,
  List<String>? fontFamilyFallback,
  String? package,
  this.overflow,
}) : fontFamily = package == null ? fontFamily : 'packages/$package/$fontFamily',
     _fontFamilyFallback = fontFamilyFallback,
     _package = package,
     assert(color == null || foreground == null, _kColorForegroundWarning),
     assert(backgroundColor == null || background == null, _kColorBackgroundWarning);