getConstraintsForChild method

BoxConstraints getConstraintsForChild(
  1. BoxConstraints constraints
)

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;
  }
  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;
  }
  return BoxConstraints(
    minWidth: minWidth,
    maxWidth: maxWidth,
    minHeight: minHeight,
    maxHeight: maxHeight,
  );
}