getTextSize function
It plots the text size in base of the current style and current chars
Implementation
Size getTextSize(String text, ZwapTextType textType, {double? maxWidth}) {
final TextPainter textPainter =
TextPainter(text: TextSpan(text: text, style: getTextStyle(textType)), maxLines: 1, textDirection: TextDirection.ltr)
..layout(minWidth: 0, maxWidth: maxWidth ?? double.infinity);
return textPainter.size;
}