copyWith method

Text copyWith({
  1. String? data,
  2. Key? key,
  3. TextStyle? style,
  4. StrutStyle? strutStyle,
  5. TextAlign? textAlign,
  6. TextDirection? textDirection,
  7. Locale? locale,
  8. bool? softWrap,
  9. TextOverflow? overflow,
  10. double? textScaleFactor,
  11. int? maxLines,
  12. String? semanticsLabel,
  13. TextWidthBasis? textWidthBasis,
  14. TextHeightBehavior? textHeightBehavior,
})

todo 手机号中间四位省略为*号,或类似场景。正则? truncationMode leading tail middle todo 艺术字效果 边框、渐变…… foreground paint

Implementation

// String phoneNumber = '13888888888';
// String phoneNumberStr = phoneNumber.replaceFirst(RegExp(r'\d{4}'), '****', 3);

///todo 艺术字效果 边框、渐变……
///foreground paint

Text copyWith({
  String? data,
  Key? key,
  TextStyle? style,
  StrutStyle? strutStyle,
  TextAlign? textAlign,
  TextDirection? textDirection,
  Locale? locale,
  bool? softWrap,
  TextOverflow? overflow,
  double? textScaleFactor,
  int? maxLines,
  String? semanticsLabel,
  TextWidthBasis? textWidthBasis,
  TextHeightBehavior? textHeightBehavior,
}) {
  return Text(data ?? this.data!,
      key: key ?? this.key,
      style: style ?? this.style,
      strutStyle: strutStyle ?? this.strutStyle,
      textAlign: textAlign ?? this.textAlign,
      textDirection: textDirection ?? this.textDirection,
      locale: locale ?? this.locale,
      softWrap: softWrap ?? this.softWrap,
      overflow: overflow ?? this.overflow,
      textScaleFactor: textScaleFactor ?? this.textScaleFactor,
      maxLines: maxLines ?? this.maxLines,
      semanticsLabel: semanticsLabel ?? this.semanticsLabel,
      textWidthBasis: textWidthBasis ?? this.textWidthBasis,
      textHeightBehavior: textHeightBehavior ?? this.textHeightBehavior);
}