SearchableDropDown constructor
- Key? key,
- required ValueChanged<
SearchableDropDownItem> onSelected, - required dynamic value,
- VoidCallback? onTapCancel,
- EdgeInsetsGeometry? contentPadding,
- String? hintText,
- Widget? label,
- ValueChanged<
String> ? onSearch, - Widget? itemBuilder()?,
- Color? hoverColor,
- String? validator()?,
- TextStyle? errorStyle,
- TextStyle? textStyle,
- AutovalidateMode? autovalidateMode,
- bool? enabled,
- int? maxLines = 1,
- InputDecoration? decoration,
- bool expands = false,
- Color selectedColor = Colors.blue,
- bool? autoFocus,
- TextEditingController? textController,
- VoidCallback? onTap,
- void onTapOutside()?,
- double iconSize = 20,
- 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,
});