copyWith method

TextStyle copyWith({
  1. Display? display,
  2. Color? color,
  3. Color? backgroundColor,
  4. Gradient? gradient,
  5. bool? softWrap,
  6. Dim? fontSize,
  7. FontWeight? fontWeight,
  8. FontStyle? fontStyle,
  9. FontFamily? fontFamily,
  10. Dim? letterSpacing,
  11. Dim? wordSpacing,
  12. Dim? lineHeight,
  13. Dim? width,
  14. TextDecorationLine? decorationLine,
  15. Color? decorationLineColor,
  16. TextDecorationStyle? decorationStyle,
  17. Dim? decorationThickness,
  18. TextAlign? textAlign,
  19. bool? truncate,
  20. bool? selectable,
  21. int? maxLines,
  22. EdgeInsets? padding,
  23. EdgeInsets? margin,
  24. Map<String, String>? extra,
  25. Color? selectionBackgroundColor,
  26. Color? selectionTextColor,
  27. TextOverflow? overflow,
})

Creates a copy of this text style with the existing style attributes replaced with the new values, while null attributes remain unchanged.

Implementation

TextStyle copyWith({
  Display? display,
  Color? color,
  Color? backgroundColor,
  Gradient? gradient,
  bool? softWrap,
  Dim? fontSize,
  FontWeight? fontWeight,
  FontStyle? fontStyle,
  FontFamily? fontFamily,
  Dim? letterSpacing,
  Dim? wordSpacing,
  Dim? lineHeight,
  Dim? width,
  TextDecorationLine? decorationLine,
  Color? decorationLineColor,
  TextDecorationStyle? decorationStyle,
  Dim? decorationThickness,
  TextAlign? textAlign,
  bool? truncate,
  bool? selectable,
  int? maxLines,
  EdgeInsets? padding,
  EdgeInsets? margin,
  Map<String, String>? extra,
  Color? selectionBackgroundColor,
  Color? selectionTextColor,
  TextOverflow? overflow,
}) {
  return TextStyle(
    display: display ?? this.display,
    color: color ?? this.color,
    backgroundColor: backgroundColor ?? this.backgroundColor,
    gradient: gradient ?? this.gradient,
    fontSize: fontSize ?? this.fontSize,
    fontWeight: fontWeight ?? this.fontWeight,
    fontStyle: fontStyle ?? this.fontStyle,
    fontFamily: fontFamily ?? this.fontFamily,
    letterSpacing: letterSpacing ?? this.letterSpacing,
    wordSpacing: wordSpacing ?? this.wordSpacing,
    lineHeight: lineHeight ?? this.lineHeight,
    softWrap: softWrap ?? this.softWrap,
    width: width ?? this.width,
    decorationLine: decorationLine ?? this.decorationLine,
    decorationLineColor: decorationLineColor ?? this.decorationLineColor,
    decorationStyle: decorationStyle ?? this.decorationStyle,
    decorationThickness: decorationThickness ?? this.decorationThickness,
    textAlign: textAlign ?? this.textAlign,
    truncate: truncate ?? this.truncate,
    selectable: selectable ?? this.selectable,
    maxLines: maxLines ?? this.maxLines,
    padding: padding ?? this.padding,
    margin: margin ?? this.margin,
    selectionBackgroundColor:
        selectionBackgroundColor ?? this.selectionBackgroundColor,
    selectionTextColor: selectionTextColor ?? this.selectionTextColor,
    overflow: overflow ?? this.overflow,
    extra: (this.extra ?? {}).combine(extra ?? {}),
  );
}