dropdownHeight property

  1. @override
double get dropdownHeight
override

Gets the height of the dropdown suggestions list.

Currently set to a fixed height of 200 pixels.

Implementation

@override
double get dropdownHeight {
  double height = 0;

  int dataLength = 0;

  if (nestedInitData.isEmpty && (baseSearchResults.isNotEmpty || selectorTextEditingController.text.isNotEmpty)) {
    dataLength = baseSearchResults.isNotEmpty || selectorTextEditingController.text.isNotEmpty
        ? baseSearchResults.length
        : initData.length;
  } else if (baseSearchResults.isNotEmpty || selectorTextEditingController.text.isNotEmpty) {
    dataLength = baseSearchResults.length;
  } else if (suggestionsExpanded) {
    return 200;
  }

  if (suggestionsExpanded) {
    if (dataLength < 5) {
      height = (dataLength * 40) + 40;
    } else {
      height = selectorMaxHeight ?? 200;
    }
  }

  return height;
}