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