TextStyle constructor Null safety
- {bool inherit = true,
- Color? color,
- Color? backgroundColor,
- double? fontSize,
- FontWeight? fontWeight,
- FontStyle? fontStyle,
- double? letterSpacing,
- double? wordSpacing,
- TextBaseline? textBaseline,
- double? height,
- TextLeadingDistribution? leadingDistribution,
- Locale? locale,
- Paint? foreground,
- Paint? background,
- List<
Shadow> ? shadows, - List<
FontFeature> ? fontFeatures, - List<
FontVariation> ? fontVariations, - TextDecoration? decoration,
- Color? decorationColor,
- TextDecorationStyle? decorationStyle,
- double? decorationThickness,
- String? debugLabel,
- String? fontFamily,
- List<
String> ? fontFamilyFallback, - String? package,
- 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.
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(inherit != null),
assert(color == null || foreground == null, _kColorForegroundWarning),
assert(backgroundColor == null || background == null, _kColorBackgroundWarning);