getMaxIntrinsicWidth method
- @mustCallSuper
Returns the smallest width beyond which increasing the width never decreases the preferred height. The preferred height is the value that would be returned by getMinIntrinsicHeight for that width.
The height argument may give a specific height to assume. The given height can be infinite, meaning that the intrinsic width in an unconstrained environment is being requested. The given height should never be negative or null.
This function should only be called on one's children. Calling this function couples the child with the parent so that when the child's layout changes, the parent is notified (via markNeedsLayout).
Calling this function is expensive and as it can result in O(N^2) behavior.
Do not override this method. Instead, implement computeMaxIntrinsicWidth.
Implementation
@mustCallSuper
double getMaxIntrinsicWidth(double height) {
assert(() {
if (height == null) {
throw FlutterError(
'The height argument to getMaxIntrinsicWidth was null.\n'
'The argument to getMaxIntrinsicWidth must not be negative or null. '
'If you do not have a specific height in mind, then pass double.infinity instead.'
);
}
if (height < 0.0) {
throw FlutterError(
'The height argument to getMaxIntrinsicWidth was negative.\n'
'The argument to getMaxIntrinsicWidth must not be negative or null. '
'If you perform computations on another height before passing it to '
'getMaxIntrinsicWidth, consider using math.max() or double.clamp() '
'to force the value into the valid range.'
);
}
return true;
}());
return _computeIntrinsicDimension(_IntrinsicDimension.maxWidth, height, computeMaxIntrinsicWidth);
}