UniversalDropdown<T> class

Inheritance

Constructors

UniversalDropdown({Key? key, List<T>? items, List<T>? selectedItems, required ValueChanged<List<T>> onChanged, Future<List<T>> fetchItems(int page, int pageSize, String query)?, bool multiSelect = false, bool closeOnSelectWhenSingle = true, bool searchable = false, bool paginate = false, int pageSize = 20, Color dragPanelBgColor = Colors.white, String placeholder = 'Select…', DropdownMode mode = DropdownMode.overlay, Alignment dropdownAlignment = Alignment.topLeft, Offset dropdownOffset = Offset.zero, BoxDecoration? dropdownDecoration, double dropdownMaxHeight = 320, EdgeInsetsGeometry dropdownPadding = const EdgeInsets.symmetric(vertical: 8, horizontal: 8), VoidCallback? handleScroll, required Widget itemBuilder(BuildContext context, T item, bool isSelected, int index), Widget selectedDisplayBuilder(BuildContext context, List<T> selected, VoidCallback open, VoidCallback clear)?, Widget checkboxBuilder(BuildContext context, bool isSelected)?, CheckboxPosition checkboxPosition = CheckboxPosition.leading, Widget chipBuilder(BuildContext context, T item, VoidCallback onRemove)?, ChipPlacement chipPlacement = ChipPlacement.belowField, double chipSpacing = 8, WrapAlignment chipWrapAlignment = WrapAlignment.start, Widget searchBarBuilder(BuildContext context, TextEditingController controller, VoidCallback clear, ValueChanged<String> onChanged)?, Widget loaderBuilder(BuildContext context)?, Widget emptyStateBuilder(BuildContext context)?, Widget headerBuilder(BuildContext context)?, Widget footerBuilder(BuildContext context)?, Widget separatorBuilder(BuildContext context, int index)?, EdgeInsetsGeometry listPadding = const EdgeInsets.symmetric(vertical: 4), Duration animationDuration = const Duration(milliseconds: 180), Curve animationCurve = Curves.easeOutCubic})

Properties

animationCurve Curve
final
animationDuration Duration
Animation tuning (overlay open/close).
final
checkboxBuilder Widget Function(BuildContext context, bool isSelected)?
Build the checkbox/toggle indicator used for each item. If null, a Material Checkbox/Radio is used depending on multiSelect.
final
checkboxPosition CheckboxPosition
Where to place the checkbox relative to the item row.
final
chipBuilder Widget Function(BuildContext context, T item, VoidCallback onRemove)?
Chips for multi-select summary (when not providing your own selected display).
final
chipPlacement ChipPlacement
Where to render the chips (if using default selected display).
final
chipSpacing double
Spacing + alignment for default chips area.
final
chipWrapAlignment WrapAlignment
final
closeOnSelectWhenSingle bool
final
dragPanelBgColor Color
BottomSheet Draggable Panel background Color
final
final
final
final
final
final
emptyStateBuilder Widget Function(BuildContext context)?
Empty-state when there are no items to show.
final
fetchItems Future<List<T>> Function(int page, int pageSize, String query)?
Async data source for pagination / server search. Signature: (page, pageSize, searchQuery) => Future<List
final
footerBuilder Widget Function(BuildContext context)?
final
handleScroll VoidCallback?
Handle Pagination Scroll
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
headerBuilder Widget Function(BuildContext context)?
Optional header/footer widgets inside dropdown panel.
final
itemBuilder Widget Function(BuildContext context, T item, bool isSelected, int index)
===== Builders: give you total control ===== Item row in the list (you decide every pixel).
final
items List<T>?
Static items (optional if using fetchItems).
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listPadding EdgeInsetsGeometry
List padding inside dropdown.
final
loaderBuilder Widget Function(BuildContext context)?
Loader for pagination.
final
mode DropdownMode
final
multiSelect bool
===== Behavior =====
final
onChanged ValueChanged<List<T>>
Callback when selection changes.
final
pageSize int
final
paginate bool
final
placeholder String
===== Visuals: Field & Dropdown =====
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollCtrl ScrollController
ScrollController
final
searchable bool
final
searchBarBuilder Widget Function(BuildContext context, TextEditingController controller, VoidCallback clear, ValueChanged<String> onChanged)?
Search bar (fully custom). Given controller + clear helper + onChanged.
final
selectedDisplayBuilder Widget Function(BuildContext context, List<T> selected, VoidCallback open, VoidCallback clear)?
How the closed field looks. Tap should open the dropdown; we also pass a helper open to do that and clear to clear selection.
final
selectedItems List<T>?
Pre-selected items (mutated internally via copies; original list is not modified).
final
separatorBuilder Widget Function(BuildContext context, int index)?
Optional separator between items.
final

Methods

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