getSize method

Size getSize()

Returns the size of the text.

Implementation

Size getSize() {
  final textPainter = TextPainter(
    text: TextSpan(text: this.data, style: this.style),
    maxLines: this.maxLines,
    textDirection: TextDirection.ltr,
  )..layout(minWidth: 0, maxWidth: double.infinity);
  return textPainter.size;
}