performLayout method

  1. @override
void performLayout(
  1. Constraints constraints
)
override

Called to perform the actual layout computation for this render object.

Implementation

@override
void performLayout(Constraints constraints) {
  final boxConstraints = constraints.asBoxConstraints;
  final maxWidth = boxConstraints.maxWidth;

  _segments = [];
  _text._collectStyledSegments(_segments, null);

  _lines = _wrapLines(_segments, maxWidth);
  _applyOverflow();

  final computedWidth = _computeMaxLineWidth();
  final effectiveMaxHeight =
      boxConstraints.maxHeight > 0 ? boxConstraints.maxHeight : 1;
  final width = computedWidth.clamp(
    boxConstraints.minWidth,
    boxConstraints.maxWidth,
  );
  final height =
      _lines.isEmpty ? 1 : _lines.length.clamp(1, effectiveMaxHeight);

  size = Size(width, height);
}