computePopupSize function

Size computePopupSize(
  1. RenderBox dropdown,
  2. RenderBox overlay,
  3. BoxConstraints popUpConstraints
)

Implementation

Size computePopupSize(
    RenderBox dropdown, RenderBox overlay, BoxConstraints popUpConstraints) {
  var menuMinWidth = popUpConstraints.minWidth;
  var menuMaxWidth = popUpConstraints.maxWidth;

  var menuMinHeight = popUpConstraints.minHeight;
  var menuMaxHeight = popUpConstraints.maxHeight;

  var menuWidth = dropdown.size.width;
  var menuHeight = 350.0;

  if (menuMinWidth > 0) {
    menuWidth = menuMinWidth;
  }
  if (menuMaxWidth > 0 && menuMaxWidth < menuWidth) {
    menuWidth = menuMaxWidth;
  }

  if (menuMinHeight > 0) {
    menuHeight = menuMinHeight;
  }
  if (menuMaxHeight > 0 && menuMaxHeight < menuHeight) {
    menuHeight = menuMaxHeight;
  }

  return Size(menuWidth, menuHeight);
}