withStyle method

  1. @Deprecated('This style is not anymore maintained and will be deleted in next major update (4.0).')
Text withStyle({
  1. double fontSize = 16,
  2. FontWeight? fontWeight,
  3. Color color = textPrimaryColor,
  4. FontStyle? fontStyle,
  5. Paint? foreground,
  6. double? wordSpacing,
  7. Color? backgroundColor,
  8. Color? decorationColor,
  9. TextDecoration? textDecoration,
  10. TextDecorationStyle? decorationStyle,
  11. double? decorationThickness,
  12. List<Shadow>? shadows,
  13. double? letterSpacing,
  14. Locale? locale,
  15. TextBaseline? textBaseline,
  16. Paint? background,
  17. String? fontFamily,
  18. List<String>? fontFamilyFallback,
  19. List<FontFeature>? fontFeatures,
  20. String? debugLabel,
  21. double? height,
  22. bool? inherit,
})

Implementation

@Deprecated(
  'This style is not anymore maintained and will be deleted in next major update (4.0).',
)
Text withStyle({
  double fontSize = 16,
  FontWeight? fontWeight,
  Color color = textPrimaryColor,
  FontStyle? fontStyle,
  Paint? foreground,
  double? wordSpacing,
  Color? backgroundColor,
  Color? decorationColor,
  TextDecoration? textDecoration,
  TextDecorationStyle? decorationStyle,
  double? decorationThickness,
  List<Shadow>? shadows,
  double? letterSpacing,
  Locale? locale,
  TextBaseline? textBaseline,
  Paint? background,
  String? fontFamily,
  List<String>? fontFamilyFallback,
  List<FontFeature>? fontFeatures,
  String? debugLabel,
  double? height,
  bool? inherit,
}) {
  final style = TextStyle().copyWith(
    color: color,
    fontWeight: fontWeight,
    fontSize: fontSize,
    fontStyle: fontStyle,
    foreground: foreground,
    wordSpacing: wordSpacing,
    backgroundColor: backgroundColor,
    decorationColor: decorationColor,
    decoration: textDecoration,
    decorationStyle: decorationStyle,
    decorationThickness: decorationThickness,
    shadows: shadows,
    letterSpacing: letterSpacing,
    locale: locale,
    textBaseline: textBaseline,
    background: background,
    fontFamily: fontFamily,
    fontFamilyFallback: fontFamilyFallback,
    fontFeatures: fontFeatures,
    debugLabel: debugLabel,
    height: height,
    inherit: inherit,
  );

  return Text(
    data!,
    style: style,
    textAlign: textAlign,
    strutStyle: strutStyle,
    softWrap: softWrap,
    semanticsLabel: semanticsLabel,
    locale: this.locale,
    overflow: overflow,
    textWidthBasis: textWidthBasis,
    textDirection: textDirection,
    textScaleFactor: textScaleFactor,
    maxLines: maxLines,
  );
}