textWidth method
Return the textwidth of the text in the given style
Implementation
double textWidth(String text, TextStyle textStyle) {
return (TextPainter(
text: TextSpan(text: text, style: textStyle),
maxLines: 1,
textDirection: TextDirection.ltr,
)..layout())
.size
.width;
}