computeMaxIntrinsicHeight method

  1. @override
double computeMaxIntrinsicHeight(
  1. double width
)
override

Computes the value returned by getMaxIntrinsicHeight. Do not call this function directly, instead, call getMaxIntrinsicHeight.

Override in subclasses that implement performLayout. Should return the smallest height beyond which increasing the height never decreases the preferred width. The preferred width is the value that would be returned by computeMinIntrinsicWidth for that height.

If the layout algorithm is strictly width-in-height-out, or is width-in-height-out when the height is unconstrained, then this should return the same value as computeMinIntrinsicHeight for the same width.

Otherwise, the width argument should be ignored, and the returned value should be equal to or bigger than the value returned by computeMinIntrinsicHeight.

The width argument will never be negative or null. It may be infinite.

The value returned by this method might not match the size that the object would actually take. For example, a RenderBox subclass that always exactly sizes itself using BoxConstraints.biggest might well size itself bigger than its max intrinsic size.

If this algorithm depends on the intrinsic dimensions of a child, the intrinsic dimensions of that child should be obtained using the functions whose names start with get, not compute.

This function should never return a negative or infinite value.

Be sure to set debugCheckIntrinsicSizes to true in your unit tests if you do override this method, which will add additional checks to help validate your implementation.

See also:

Implementation

@override
double computeMaxIntrinsicHeight(double width) {
  return computeTableSize(BoxConstraints.loose(Size(width, double.infinity)),
      (child, extent) {
    return child.getMaxIntrinsicHeight(extent);
  }).height;
}