paintWidthWithTextStyle method

double paintWidthWithTextStyle(
  1. TextStyle style, {
  2. double? maxWidth,
})

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;
}