calculateTextHeight function
Implementation
double calculateTextHeight(String text, TextStyle style) {
final textPainter = TextPainter(
text: TextSpan(text: text, style: style),
textDirection: TextDirection.ltr,
)..layout();
return textPainter.size.height;
}