getTextHeight method

int getTextHeight(
  1. String text
)

Calculates the total height of the given text in pixels.

Args: text (String): The text to calculate the height for.

Returns: int: The total height of the text in pixels.

Implementation

int getTextHeight(String text) {
  final numLines = text.split("\n").length;
  return numLines * lineHeight;
}