SearchableDropDown class

A customizable dropdown widget with search functionality.

Displays a list of SearchableDropDownItem and allows the user to type to filter the list. When an item is selected, onSelected callback is triggered.

Inheritance

Constructors

SearchableDropDown.new({Key? key, double menuMaxHeight = 200, required List<SearchableDropDownItem> menuList, required ValueChanged<SearchableDropDownItem> onSelected, required dynamic value, VoidCallback? onTapCancel, ShapeBorder? menuShape, Color? menuColor = Colors.white, EdgeInsetsGeometry? contentPadding, String? hintText, Widget? label, TextStyle? menuTextStyle, ValueChanged<String>? onSearch, Widget? itemBuilder(BuildContext, int)?, Color? hoverColor, String? validator(String?)?, TextStyle? errorStyle, TextStyle? textStyle, AutovalidateMode? autovalidateMode, bool? enabled, int? maxLines = 1, InputDecoration? decoration, bool expands = false, Color selectedColor = Colors.blue, MenuAlignment? menuAlignment, bool? autoFocus, TextEditingController? textController, VoidCallback? onTap, void onTapOutside(PointerDownEvent)?, double iconSize = 20, bool showCancelButton = true})
Creates a SearchableDropDown with the provided parameters.
const

Properties

autoFocus bool?
auto focus for the testfield
final
autovalidateMode AutovalidateMode?
Controls when validation is triggered.
final
contentPadding EdgeInsetsGeometry?
Padding inside the input field.
final
decoration InputDecoration?
Custom decoration for the input field.
final
enabled bool?
Whether the dropdown (input field) is enabled.
final
errorStyle TextStyle?
Text style for displaying validation error messages.
final
expands bool
If true, the input field expands to fill available space.
final
hashCode int
The hash code for this object.
no setterinherited
hintText String?
Hint text displayed in the input field when empty.
final
hoverColor Color?
Color used to indicate an item is hovered (currently not applied).
final
iconSize double
final
itemBuilder Widget? Function(BuildContext, int)?
Custom builder for rendering dropdown items. Receives the context and item index.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label Widget?
A widget to display as a label for the input field.
final
maxLines int?
Maximum lines of the input field.
final
Alignment of the dropdown menu relative to the input field.
final
Background color of the dropdown menu.
final
List of items to display in the dropdown.
final
The maximum height of the dropdown menu. If null, height is determined by content.
final
Shape of the dropdown menu (e.g., rounded corners).
final
Text style for items in the dropdown menu.
final
onSearch ValueChanged<String>?
Callback when the search text changes. If provided, this is called with the current search query.
final
onSelected ValueChanged<SearchableDropDownItem>
Callback triggered when an item is selected. Provides the selected SearchableDropDownItem.
final
onTap VoidCallback?
Function called onTap on textField
final
onTapCancel VoidCallback?
Callback when the user taps the cancel/clear icon.
final
onTapOutside → void Function(PointerDownEvent)?
Function called onTapOutside on textField
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedColor Color
Color used for the selected item text in the menu.
final
showCancelButton bool
This controls weather to show or hide cancel button
final
textController TextEditingController?
Text Controller for the text field
final
textStyle TextStyle?
Text style for the text input field.
final
validator String? Function(String?)?
Function to validate the input text.
final
value → dynamic
The currently selected value. This should correspond to one of the values in menuList.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SearchableDropDown>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited