StatePickerDropdown<T> class

A custom dropdown widget for selecting states with advanced filtering, sorting, and customization options.

StatePickerDropdown allows you to provide custom filters, sort logic, and item builders, enabling extensive customization for dropdown-based state selection.

T represents the type of the dropdown items.

Inheritance

Constructors

StatePickerDropdown({Key? key, required ValueChanged<T> onValuePicked, bool itemFilter(T item)?, Comparator<T>? sortComparator, List<T>? states, List<T>? topStates, double? mainHeight, bool isEqual(T state, T topState)?, Widget itemBuilder(T item)?, T? selectedState, bool isExpanded = false, double? itemHeight = kMinInteractiveDimension, Widget selectedItemBuilder(T item)?, bool isDense = false, Widget? underline, Color? dropdownColor, VoidCallback? onTap, Widget? icon, Color? iconDisabledColor, Color? iconEnabledColor, double iconSize = 24.0, Widget? hint, Widget? disabledHint, bool isFirstDefaultIfInitialValueNotProvided = true})
Creates a StatePickerDropdown with the provided configuration.
const

Properties

disabledHint Widget?
A widget displayed when the dropdown is disabled.
final
The background color of the dropdown.
final
hashCode int
The hash code for this object.
no setterinherited
hint Widget?
A placeholder widget displayed when no item is selected.
final
icon Widget?
The icon displayed to indicate dropdown functionality.
final
iconDisabledColor Color?
The color of the icon when the dropdown is disabled.
final
iconEnabledColor Color?
The color of the icon when the dropdown is enabled.
final
iconSize double
The size of the dropdown icon. Defaults to 24.0.
final
isDense bool
Indicates whether the dropdown should use a compact layout.
final
isEqual bool Function(T state, T topState)?
A custom equality function used to compare two items. This is especially useful for identifying duplicates in lists.
final
isExpanded bool
A boolean indicating whether the dropdown expands to fill available space.
final
isFirstDefaultIfInitialValueNotProvided bool
If true, the first item in the list is selected by default when no initial value is provided.
final
itemBuilder Widget Function(T item)?
A custom widget builder for rendering each item in the dropdown. Example: Building a ListTile or a Card for each item.
final
itemFilter bool Function(T item)?
Filters the available list of items to only include those that match certain criteria. Example: Filtering states that start with a specific letter.
final
itemHeight double?
The height of each dropdown item. Defaults to kMinInteractiveDimension.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mainHeight double?
The height of each dropdown item. Defaults to kMinInteractiveDimension.
final
onTap VoidCallback?
A callback triggered when the dropdown is tapped.
final
onValuePicked ValueChanged<T>
A callback triggered whenever an item is selected from the dropdown. The selected item is passed to the callback function.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedItemBuilder Widget Function(T item)?
A custom builder for rendering the selected item.
final
selectedState → T?
The initial value selected in the dropdown. If no initial value is provided, the first item in the list is selected by default.
final
sortComparator Comparator<T>?
A comparator used to sort the list of items. The comparison logic is customizable. Example: Sorting states alphabetically.
final
states List<T>?
The full list of available states/items to be displayed in the dropdown.
final
topStates List<T>?
A list of items to be displayed at the top of the dropdown. These items are prioritized over the rest of the list.
final
underline Widget?
The widget displayed under the dropdown. Defaults to an empty widget.
final

Methods

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