getConstraintsForChild method
Implementation
BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
double minWidth = 0;
double maxWidth = constraints.maxWidth;
double minHeight = 0;
double maxHeight = constraints.maxHeight;
if (_widthConstraint == PopoverConstraint.anchorFixedSize) {
assert(_anchorSize != null, 'anchorSize must not be null');
minWidth = _anchorSize!.width;
maxWidth = _anchorSize!.width;
} else if (_widthConstraint == PopoverConstraint.anchorMinSize) {
assert(_anchorSize != null, 'anchorSize must not be null');
minWidth = _anchorSize!.width;
} else if (_widthConstraint == PopoverConstraint.anchorMaxSize) {
assert(_anchorSize != null, 'anchorSize must not be null');
maxWidth = _anchorSize!.width;
} else if (_widthConstraint == PopoverConstraint.intrinsic) {
double intrinsicWidth = child!.getMaxIntrinsicWidth(double.infinity);
if (intrinsicWidth.isFinite) {
maxWidth = max(minWidth, intrinsicWidth);
}
}
if (_heightConstraint == PopoverConstraint.anchorFixedSize) {
assert(_anchorSize != null, 'anchorSize must not be null');
minHeight = _anchorSize!.height;
maxHeight = _anchorSize!.height;
} else if (_heightConstraint == PopoverConstraint.anchorMinSize) {
assert(_anchorSize != null, 'anchorSize must not be null');
minHeight = _anchorSize!.height;
} else if (_heightConstraint == PopoverConstraint.anchorMaxSize) {
assert(_anchorSize != null, 'anchorSize must not be null');
maxHeight = _anchorSize!.height;
} else if (_heightConstraint == PopoverConstraint.intrinsic) {
double intrinsicHeight = child!.getMaxIntrinsicHeight(double.infinity);
if (intrinsicHeight.isFinite) {
maxHeight = max(minHeight, intrinsicHeight);
}
}
return BoxConstraints(
minWidth: minWidth,
maxWidth: maxWidth,
minHeight: minHeight,
maxHeight: maxHeight,
);
}