toggleSuggestionsExpanded method

void toggleSuggestionsExpanded({
  1. Widget? selectorWidget,
  2. bool expanded = true,
})

Toggles the state of the suggestions list between expanded and collapsed.

Expands the dropdown if it's collapsed, and collapses it if it's already expanded.

Implementation

void toggleSuggestionsExpanded(
    {Widget? selectorWidget, bool expanded = true}) {
  suggestionsExpanded = !suggestionsExpanded;
  if (suggestionsExpanded) {
    expandSuggestions(
      selectorWidget: selectorWidget,
      expanded: expanded,
    );
  } else {
    closeSuggestions();
  }
}