SearchableDropdownField<T> constructor

const SearchableDropdownField<T>({
  1. Key? key,
  2. String? label,
  3. required List<T> items,
  4. T? value,
  5. ValueChanged<T?>? onChanged,
  6. required String itemLabel(
    1. T
    ),
  7. FormFieldValidator<T>? validator,
  8. InputDecoration? decoration,
  9. String? hintText,
  10. String? searchHintText,
  11. String? noItemsFoundText,
  12. Widget? prefixIcon,
  13. Widget? suffixIcon,
  14. bool showSearchBox = true,
  15. bool searchMatcher(
    1. T item,
    2. String query
    )?,
  16. Icon? searchIcon,
  17. Icon? dropdownIcon,
  18. bool enableClearButton = true,
  19. String? clearButtonTooltip,
  20. int? maxHeight,
  21. double? dropdownWidth,
  22. bool closeOnSelection = true,
  23. bool showCheckboxes = false,
  24. bool enableMultiSelect = false,
  25. List<T>? selectedValues,
  26. ValueChanged<List<T>>? onMultiSelectChanged,
  27. Widget itemBuilder(
    1. T item
    )?,
  28. Widget selectedItemBuilder(
    1. T item,
    2. bool isSelected
    )?,
  29. double? itemHeight,
  30. EdgeInsets? itemPadding,
  31. Widget? dropdownHeader,
  32. Widget? dropdownFooter,
  33. VoidCallback? onAddNew,
  34. String? addNewText,
  35. bool autofocus = false,
  36. FocusNode? focusNode,
  37. String? semanticLabel,
  38. bool showSelectedItemsChips = false,
  39. int? maxSelectedItemsToShow,
  40. bool isLoading = false,
  41. Widget? loadingWidget,
  42. Future<List<T>> asyncItemsLoader(
    1. String query
    )?,
  43. Color? dropdownBackgroundColor,
  44. BorderRadius? dropdownBorderRadius,
  45. double? dropdownElevation,
  46. TextStyle? selectedItemTextStyle,
  47. 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);