computeMinIntrinsicHeight method
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:
- computeMinIntrinsicWidth, which has usage examples.
- computeMaxIntrinsicHeight, which computes the smallest height beyond which increasing the height never decreases the preferred width.
Implementation
@override
double computeMinIntrinsicHeight(double width) {
var height = 0.0;
for (final box in children) {
height += box.getMinIntrinsicHeight(double.infinity);
}
return height;
}