computeMinIntrinsicHeight method

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

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

Override in subclasses that implement performLayout. Should return the minimum height that this box could be without failing to correctly paint its contents within itself, without clipping.

If the layout algorithm is independent of the context (e.g. it always tries to be a particular size), or if the layout algorithm is height-in-width-out, or if the layout algorithm uses both the incoming height and width constraints (e.g. it always sizes itself to BoxConstraints.biggest), then the width argument should be ignored.

If the layout algorithm is strictly width-in-height-out, or is width-in-height-out when the height is unconstrained, then the width argument is the width to use.

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

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 computeMinIntrinsicHeight(double width) {
  _resolve();
  final double totalHorizontalPadding =
      _resolvedPadding!.left + _resolvedPadding!.right;
  final double totalVerticalPadding =
      _resolvedPadding!.top + _resolvedPadding!.bottom;
  if (child != null) {
    return child!.getMinIntrinsicHeight(
            math.max(0.0, width - totalHorizontalPadding)) +
        totalVerticalPadding;
  }
  return totalVerticalPadding;
}