paintWidthWithTextStyle method
Implementation
double paintWidthWithTextStyle(TextStyle style, {double? maxWidth}) {
final TextPainter textPainter =
TextPainter(text: TextSpan(text: this, style: style), maxLines: 1, textDirection: TextDirection.ltr)
..layout(minWidth: 0, maxWidth: maxWidth ?? double.infinity);
return textPainter.size.width;
}