uiComboBox<T> method
- required List<
DropdownMenuEntry< dropdownMenuEntries,T> > - Key? key,
- bool enabled = true,
- bool enableFilter = false,
- bool enableSearch = true,
- String? errorText,
- String? helperText,
- String? hintText,
- T? initialSelection,
- Widget? label,
- dynamic leadingIcon,
- void onSelected(
- T?
- int? searchCallback(
- List<
DropdownMenuEntry< ,T> > - String
- List<
- DropdownMenuThemeData? style,
- dynamic trailingIcon,
- double? width,
Creates a customizable combo box drop down with the ability to implement a search box to filter the combo box.
Implementation
Widget uiComboBox<T>({
required List<DropdownMenuEntry<T>> dropdownMenuEntries,
Key? key,
bool enabled = true,
bool enableFilter = false,
bool enableSearch = true,
String? errorText,
double? menuHeight,
String? helperText,
String? hintText,
T? initialSelection,
Widget? label,
dynamic leadingIcon,
void Function(T?)? onSelected,
int? Function(List<DropdownMenuEntry<T>>, String)? searchCallback,
DropdownMenuThemeData? style,
dynamic trailingIcon,
double? width,
}) {
assert(
leadingIcon == null || leadingIcon is IconData || leadingIcon is Image,
"leadingIcon can only be an Image, IconData, or null type",
);
assert(
trailingIcon == null || trailingIcon is IconData || trailingIcon is Image,
"trailingIcon can only be an Image, IconData, or null type",
);
final menu = DropdownMenu<T>(
dropdownMenuEntries: dropdownMenuEntries,
enabled: enabled,
enableFilter: enableFilter,
enableSearch: enableSearch,
errorText: errorText,
helperText: helperText,
hintText: hintText,
initialSelection: initialSelection,
label: label,
leadingIcon: leadingIcon is IconData ? Icon(leadingIcon) : leadingIcon,
menuHeight: menuHeight,
onSelected: onSelected,
searchCallback: searchCallback,
trailingIcon:
trailingIcon is IconData ? Icon(trailingIcon) : trailingIcon,
width: width,
);
return style != null
? DropdownMenuTheme(
data: style,
child: menu,
)
: menu;
}