performLayout method

  1. @override
void performLayout(
  1. Constraints constraints
)
override

Implementation

@override
void performLayout(Constraints constraints) {
  int totalWidth = 0;
  for (final item in items) {
    totalWidth += stringWidth(item.label) + 2;
  }
  int maxDropdownHeight = 1;
  if (openMenuIndex >= 0 && openMenuIndex < items.length) {
    maxDropdownHeight += items[openMenuIndex].children.length;
  }
  size = Size(totalWidth, maxDropdownHeight);
}