copyWith method
Text
copyWith({
- Key? key,
- Color? color,
- double? fontSize,
- FontWeight? fontWeight,
- FontStyle? fontStyle,
- double? letterSpacing,
- double? wordSpacing,
- TextBaseline? textBaseline,
- double? height,
- StrutStyle? strutStyle,
- TextAlign? textAlign,
- TextDirection? textDirection,
- Locale? locale,
- bool? softWrap,
- TextOverflow? overflow,
- double? textScaleFactor,
- int? maxLines,
- String? semanticsLabel,
- TextWidthBasis? textWidthBasis,
- TextHeightBehavior? textHeightBehavior,
- Color? selectionColor,
- TextDecoration? decoration,
- TextStyle? style,
- String? text,
Implementation
Text copyWith(
{Key? key,
Color? color,
double? fontSize,
FontWeight? fontWeight,
FontStyle? fontStyle,
double? letterSpacing,
double? wordSpacing,
TextBaseline? textBaseline,
double? height,
StrutStyle? strutStyle,
TextAlign? textAlign,
TextDirection? textDirection,
Locale? locale,
bool? softWrap,
TextOverflow? overflow,
double? textScaleFactor,
int? maxLines,
String? semanticsLabel,
TextWidthBasis? textWidthBasis,
TextHeightBehavior? textHeightBehavior,
Color? selectionColor,
TextDecoration? decoration,
TextStyle? style,
String? text}) {
return Text(
text ?? this.data!,
key: key,
style: style ??
TextStyle(
color: color ?? this.style?.color,
fontSize: fontSize ?? this.style?.fontSize,
fontWeight: fontWeight ?? this.style?.fontWeight,
fontStyle: fontStyle ?? this.style?.fontStyle,
letterSpacing: letterSpacing ?? this.style?.letterSpacing,
wordSpacing: wordSpacing ?? this.style?.wordSpacing,
textBaseline: textBaseline ?? this.style?.textBaseline,
height: height ?? this.style?.height,
locale: locale ?? this.style?.locale,
overflow: overflow ?? this.style?.overflow,
decoration: decoration ?? this.style?.decoration,
),
strutStyle: strutStyle ?? this.strutStyle,
textAlign: textAlign ?? this.textAlign,
textDirection: textDirection ?? this.textDirection,
softWrap: softWrap ?? this.softWrap,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
maxLines: maxLines ?? this.maxLines,
semanticsLabel: semanticsLabel ?? this.semanticsLabel,
textWidthBasis: textWidthBasis ?? this.textWidthBasis,
textHeightBehavior: textHeightBehavior ?? this.textHeightBehavior,
selectionColor: selectionColor ?? this.selectionColor,
);
}