copyWith method

Text copyWith({
  1. Key? key,
  2. Color? color,
  3. double? fontSize,
  4. FontWeight? fontWeight,
  5. FontStyle? fontStyle,
  6. double? letterSpacing,
  7. double? wordSpacing,
  8. TextBaseline? textBaseline,
  9. double? height,
  10. StrutStyle? strutStyle,
  11. TextAlign? textAlign,
  12. TextDirection? textDirection,
  13. Locale? locale,
  14. bool? softWrap,
  15. TextOverflow? overflow,
  16. double? textScaleFactor,
  17. int? maxLines,
  18. String? semanticsLabel,
  19. TextWidthBasis? textWidthBasis,
  20. TextHeightBehavior? textHeightBehavior,
  21. Color? selectionColor,
  22. TextDecoration? decoration,
  23. TextStyle? style,
  24. 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,
  );
}