SearchableDropdownField<T> constructor
const
SearchableDropdownField<T> ({
- Key? key,
- String? label,
- required List<
T> items, - T? value,
- ValueChanged<
T?> ? onChanged, - required String itemLabel(
- T
- FormFieldValidator<
T> ? validator, - InputDecoration? decoration,
- String? hintText,
- String? searchHintText,
- String? noItemsFoundText,
- Widget? prefixIcon,
- Widget? suffixIcon,
- bool showSearchBox = true,
- bool searchMatcher(
- T item,
- String query
- Icon? searchIcon,
- Icon? dropdownIcon,
- bool enableClearButton = true,
- String? clearButtonTooltip,
- int? maxHeight,
- double? dropdownWidth,
- bool closeOnSelection = true,
- bool showCheckboxes = false,
- bool enableMultiSelect = false,
- List<
T> ? selectedValues, - ValueChanged<
List< ? onMultiSelectChanged,T> > - Widget itemBuilder(
- T item
- Widget selectedItemBuilder(
- T item,
- bool isSelected
- double? itemHeight,
- EdgeInsets? itemPadding,
- Widget? dropdownHeader,
- VoidCallback? onAddNew,
- String? addNewText,
- bool autofocus = false,
- FocusNode? focusNode,
- String? semanticLabel,
- bool showSelectedItemsChips = false,
- int? maxSelectedItemsToShow,
- bool isLoading = false,
- Widget? loadingWidget,
- Future<
List< asyncItemsLoader(T> >- String query
- Color? dropdownBackgroundColor,
- BorderRadius? dropdownBorderRadius,
- double? dropdownElevation,
- TextStyle? selectedItemTextStyle,
- TextStyle? itemTextStyle,
Implementation
const SearchableDropdownField({
Key? key,
// Basic Configuration
this.label,
required this.items,
this.value,
this.onChanged,
required this.itemLabel,
this.validator,
this.decoration,
// Display Options
this.hintText,
this.searchHintText,
this.noItemsFoundText,
this.prefixIcon,
this.suffixIcon,
// Search Configuration
this.showSearchBox = true,
this.searchMatcher,
this.searchIcon,
this.dropdownIcon,
this.enableClearButton = true,
this.clearButtonTooltip,
// Dropdown Behavior
this.maxHeight,
this.dropdownWidth,
this.closeOnSelection = true,
this.showCheckboxes = false,
this.enableMultiSelect = false,
this.selectedValues,
this.onMultiSelectChanged,
// Item Customization
this.itemBuilder,
this.selectedItemBuilder,
this.itemHeight,
this.itemPadding,
// Header/Footer Options
this.dropdownHeader,
this.dropdownFooter,
this.onAddNew,
this.addNewText,
// Accessibility & UX
this.autofocus = false,
this.focusNode,
this.semanticLabel,
this.showSelectedItemsChips = false,
this.maxSelectedItemsToShow,
// Loading & Async Support
this.isLoading = false,
this.loadingWidget,
this.asyncItemsLoader,
// Styling
this.dropdownBackgroundColor,
this.dropdownBorderRadius,
this.dropdownElevation,
this.selectedItemTextStyle,
this.itemTextStyle,
}) : assert(
!enableMultiSelect ||
(selectedValues != null && onMultiSelectChanged != null),
'selectedValues and onMultiSelectChanged are required when enableMultiSelect is true'),
super(key: key);