textWidth function

double textWidth(
  1. String text,
  2. TextStyle style, {
  3. int maxLines = 1,
})

Gets the width of a text with a given style.

Optionally maxLines can be provided to check overflow on text with more than one line, otherwise it defaults to 1.

See also:

Implementation

double textWidth(String text, TextStyle style, {int maxLines = 1}) =>
    _textPainter(text, style, maxLines).width;