SingleItemDropper<T> class

Single-select dropdown widget Allows selecting a single item from a searchable list

Inheritance

Constructors

SingleItemDropper({Key? key, required List<ItemDropperItem<T>> items, ItemDropperItem<T>? selectedItem, required ItemDropperItemCallback<T> onChanged, String? hintText, Widget popupItemBuilder(BuildContext, ItemDropperItem<T>, bool)?, required double width, bool enabled = true, bool showKeyboard = false, ItemDropperItem<T>? onAddItem(String searchText)?, void onDeleteItem(ItemDropperItem<T> item)?, GlobalKey<State<StatefulWidget>>? inputKey, double maxDropdownHeight = SingleSelectConstants.kDefaultMaxDropdownHeight, double elevation = ItemDropperConstants.kDropdownElevation, bool showScrollbar = true, double scrollbarThickness = ItemDropperConstants.kDefaultScrollbarThickness, TextStyle? fieldTextStyle, TextStyle? popupTextStyle, TextStyle? popupGroupHeaderStyle, double? itemHeight, BoxDecoration? fieldDecoration, bool showDropdownPositionIcon = true, bool showDeleteAllIcon = true, ItemDropperLocalizations? localizations})
const

Properties

elevation double
Popup shadow elevation.
final
enabled bool
Whether the dropdown is enabled (defaults to true).
final
fieldDecoration BoxDecoration?
Optional custom decoration for the dropdown field container.
final
fieldTextStyle TextStyle?
Text style for input/search field. If null, defaults to fontSize 12 with black color.
final
hashCode int
The hash code for this object.
no setterinherited
hintText String?
Hint/placeholder text for input field (if null, no hint).
final
inputKey GlobalKey<State<StatefulWidget>>?
Optional GlobalKey for the input field.
final
itemHeight double?
Height for popup dropdown items.
final
items List<ItemDropperItem<T>>
The items to display in the dropdown (required).
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
localizations ItemDropperLocalizations?
Localization strings for user-facing text (optional). If not provided, uses default English strings.
final
maxDropdownHeight double
Maximum dropdown popup height.
final
onAddItem ItemDropperItem<T>? Function(String searchText)?
Callback for adding new items based on search text (optional).
final
onChanged ItemDropperItemCallback<T>
Called when the selection changes (required).
final
onDeleteItem → void Function(ItemDropperItem<T> item)?
Callback for deleting items, provides the deleted item (optional).
final
popupGroupHeaderStyle TextStyle?
Text style for group headers in popup (used by default popupItemBuilder). If null, defaults to fontSize 9, bold, with reduced opacity. Ignored if custom popupItemBuilder is provided.
final
popupItemBuilder Widget Function(BuildContext, ItemDropperItem<T>, bool)?
Optional custom builder for popup items.
final
popupTextStyle TextStyle?
Text style for popup dropdown items (used by default popupItemBuilder). If null, defaults to fontSize 10. Ignored if custom popupItemBuilder is provided.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollbarThickness double
Popup vertical scrollbar thickness.
final
selectedItem ItemDropperItem<T>?
The currently selected item (optional for controlled usage).
final
showDeleteAllIcon bool
Whether to show the delete all icon (clear/X button). When true, displays a clear button that clears the current selection. Defaults to true.
final
showDropdownPositionIcon bool
Whether to show the dropdown position icon (arrow up/down). When true, displays an arrow icon that toggles the dropdown visibility. Defaults to true.
final
showKeyboard bool
Whether to show the mobile keyboard (defaults to false).
final
showScrollbar bool
Whether to show a vertical scrollbar in popup.
final
width double
The width of the dropdown field (required).
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SingleItemDropper<T>>
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