copyWith method

TextPainter copyWith({
  1. TextSpan? newTextSpan,
  2. int? lines,
  3. required double maxWidth,
})

Implementation

TextPainter copyWith({
  TextSpan? newTextSpan,
  int? lines,
  required double maxWidth,
}) {
  final copiedPainter = TextPainter(
    text: newTextSpan ?? text,
    textDirection: textDirection,
    maxLines: lines ?? maxLines,
    ellipsis: ellipsis,
    textAlign: textAlign,
  );
  copiedPainter.layout(maxWidth: maxWidth);

  return copiedPainter;
}