copyWith method
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,
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 ?? {}),
);
}