SearchableDropDown constructor

const SearchableDropDown({
  1. Key? key,
  2. double menuMaxHeight = 200,
  3. required List<SearchableDropDownItem> menuList,
  4. required ValueChanged<SearchableDropDownItem> onSelected,
  5. required dynamic value,
  6. VoidCallback? onTapCancel,
  7. ShapeBorder? menuShape,
  8. Color? menuColor = Colors.white,
  9. EdgeInsetsGeometry? contentPadding,
  10. String? hintText,
  11. Widget? label,
  12. TextStyle? menuTextStyle,
  13. ValueChanged<String>? onSearch,
  14. Widget? itemBuilder(
    1. BuildContext,
    2. int
    )?,
  15. Color? hoverColor,
  16. String? validator(
    1. String?
    )?,
  17. TextStyle? errorStyle,
  18. TextStyle? textStyle,
  19. AutovalidateMode? autovalidateMode,
  20. bool? enabled,
  21. int? maxLines = 1,
  22. InputDecoration? decoration,
  23. bool expands = false,
  24. Color selectedColor = Colors.blue,
  25. MenuAlignment? menuAlignment,
  26. bool? autoFocus,
  27. TextEditingController? textController,
  28. VoidCallback? onTap,
  29. void onTapOutside(
    1. PointerDownEvent
    )?,
  30. double iconSize = 20,
  31. bool showCancelButton = true,
})

Creates a SearchableDropDown with the provided parameters.

The menuList, onSelected, and value parameters are required. menuMaxHeight sets the maximum height of the dropdown menu. onTapCancel is called when the user taps the cancel/clear icon. menuShape defines the shape of the dropdown menu, and menuColor its background color. contentPadding, hintText, label, menuTextStyle, textStyle, and errorStyle control the appearance of the input field and menu items. onSearch is a callback invoked when the search query changes. itemBuilder can be used to provide a custom builder for menu items. hoverColor specifies the color used on hover (if supported). validator validates the input text, and autovalidateMode controls when to validate. enabled toggles whether the dropdown is interactive. maxLines sets the maximum lines for the input field. decoration allows a custom InputDecoration for the text field. expands makes the field expand to fill its parent. selectedColor is the color used for selected item text in the menu. menuAlignment controls the alignment of the dropdown menu relative to the input field onTap called on Tap of the textField. onTapOutside called on Tap Outside of the TextField.

Implementation

const SearchableDropDown({
  super.key,
  this.menuMaxHeight = 200,
  required this.menuList,
  required this.onSelected,
  required this.value,
  this.onTapCancel,
  this.menuShape,
  this.menuColor = Colors.white,
  this.contentPadding,
  this.hintText,
  this.label,
  this.menuTextStyle,
  this.onSearch,
  this.itemBuilder,
  this.hoverColor,
  this.validator,
  this.errorStyle,
  this.textStyle,
  this.autovalidateMode,
  this.enabled,
  this.maxLines = 1,
  this.decoration,
  this.expands = false,
  this.selectedColor = Colors.blue,
  this.menuAlignment,
  this.autoFocus,
  this.textController,
  this.onTap,
  this.onTapOutside,
  this.iconSize = 20,
  this.showCancelButton = true,
});