import 'package:flutter/material.dart';

extension TextExt on Text {
  Size get size {
    final textPainter = TextPainter(
        text: TextSpan(text: data, style: style),
        maxLines: 1,
        textDirection: TextDirection.ltr
    )..layout(minWidth: 0, maxWidth: double.infinity);
    return textPainter.size;
  }
}
