isTextOverflow static method

bool isTextOverflow(
  1. String text,
  2. Rect boundingRect,
  3. TextStyle textStyle,
  4. int maxLines,
)

Implementation

static bool isTextOverflow(
  String text,
  Rect boundingRect,
  TextStyle textStyle,
  int maxLines,
) {
  final TextPainter textPainter = TextPainter(
    text: TextSpan(text: text, style: textStyle),
    maxLines: maxLines,
    textDirection: TextDirection.ltr,
  );

  textPainter.layout(maxWidth: boundingRect.width);
  return textPainter.didExceedMaxLines;
}