getTextWidth method
Implementation
Size getTextWidth(TextStyle style, BuildContext context) {
TextPainter textPainter = TextPainter(
text: TextSpan(text: this, style: style),
maxLines: 1,
textScaleFactor: MediaQuery.of(context).textScaleFactor,
textDirection: TextDirection.ltr)
..layout();
return textPainter.size;
}