copyWith method

Text copyWith({
  1. Key? key,
  2. StrutStyle? strutStyle,
  3. TextAlign? textAlign,
  4. TextDirection? textDirection = TextDirection.ltr,
  5. Locale? locale,
  6. bool? softWrap,
  7. TextOverflow? overflow,
  8. TextScaler? textScaler,
  9. int? maxLines,
  10. String? semanticsLabel,
  11. TextWidthBasis? textWidthBasis,
  12. TextStyle? style,
})

Helper to apply changes.

Implementation

Text copyWith(
    {Key? key,
    StrutStyle? strutStyle,
    TextAlign? textAlign,
    TextDirection? textDirection = TextDirection.ltr,
    Locale? locale,
    bool? softWrap,
    TextOverflow? overflow,
    TextScaler? textScaler,
    int? maxLines,
    String? semanticsLabel,
    TextWidthBasis? textWidthBasis,
    TextStyle? style}) {
  return Text(this.data ?? "",
      key: key ?? this.key,
      strutStyle: strutStyle ?? this.strutStyle,
      textAlign: textAlign ?? this.textAlign,
      textDirection: textDirection ?? this.textDirection,
      locale: locale ?? this.locale,
      softWrap: softWrap ?? this.softWrap,
      overflow: overflow ?? this.overflow,
      textScaler: textScaler ?? this.textScaler,
      maxLines: maxLines ?? this.maxLines,
      semanticsLabel: semanticsLabel ?? this.semanticsLabel,
      textWidthBasis: textWidthBasis ?? this.textWidthBasis,
      style: style != null ? this.style?.merge(style) ?? style : this.style);
}