void layout({double minWidth: 0.0, double maxWidth: double.INFINITY })

Computes the visual position of the glyphs for painting the text.

The text will layout with a width that's as close to its max intrinsic width as possible while still being greater than or equal to minWidth and less than or equal to maxWidth.

Source

void layout({ double minWidth: 0.0, double maxWidth: double.INFINITY }) {
  assert(_text != null);
  if (!_needsLayout && minWidth == _lastMinWidth && maxWidth == _lastMaxWidth)
    return;
  _needsLayout = false;
  if (_paragraph == null) {
    ui.ParagraphStyle paragraphStyle = _text.style?.getParagraphStyle(
      textAlign: textAlign,
      textScaleFactor: textScaleFactor,
      ellipsis: _ellipsis,
    );
    paragraphStyle ??= new ui.ParagraphStyle();
    ui.ParagraphBuilder builder = new ui.ParagraphBuilder(paragraphStyle);
    _text.build(builder, textScaleFactor: textScaleFactor);
    _paragraph = builder.build();
  }
  _lastMinWidth = minWidth;
  _lastMaxWidth = maxWidth;
  _paragraph.layout(new ui.ParagraphConstraints(width: maxWidth));
  if (minWidth != maxWidth) {
    final double newWidth = maxIntrinsicWidth.clamp(minWidth, maxWidth);
    if (newWidth != width)
      _paragraph.layout(new ui.ParagraphConstraints(width: newWidth));
  }
}