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;

  _lines = _wrapText(text, maxWidth);
  _applyOverflow();

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

  size = Size(width, height);
}