DropdownSelector<T> class

A widget that behaves like a dropdown menu, allowing only view-mode, single and multi-selection and much more.

Inheritance

Constructors

Creates a widget that behaves like a dropdown menu, allowing only view-mode, single and multi-selection and much more.
const

Properties

allowMultiselection bool
If true, checkboxes are shown in the dropdown to allow multiselection. Note that the onSelectItem callback is called every time the user flags a checkbox, so it's developer responsability to manage selected items lists (i.e. select/deselect items)
final
child Widget?
By default, the DropdownSelector shows a custom widget to tap to open the dropdown. This widget can be overwritten by passing a custom child
final
enabled bool
If false, the dropdown does not open
final
filter List<T> Function(List<T> items, String text)?
If not null, a searchbar is shown in the dropdown to filter items by text. It takes the original items list and the searchbar text to filter, and should return the filtered items list
final
hashCode int
The hash code for this object.
no setterinherited
itemOverviewIconBuilder Widget Function(T item)?
Uses this icon instead of default one for item overview button. This is used only if onSelectItemOverview is not null.
final
items Future<List<T>> Function()
The list of items to show in the dropdown. It's a Future, so that the dropdown itself is responsbile of waiting the result while loading data.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelItemBuilder String Function(T item)
The label to show for each item of the dropdown
final
onSelectItem → void Function(T item)?
The action to take when the user selects an item. If it's null, the dropdown is only in view-mode and items cannot be selected.
final
onSelectItemOverview → void Function(T item)?
If this method is not null, a "detail" icon is shown on the right side of each dropdown item tile, to eventually do something such as opening a modal detail.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchBoxSize Size?
The size of the default searchbox widget shown to allow opening the dropdown.
final
selectedItemLabel String?
The label to show in the default dropdown box when the dropdown is closed. Defautls to "Seleziona". It should be updated every time the user selects an item, eventually with a setState, so that the label reflects the user choice.
final
selectedItems List<T>?
This list is used when allowMultiselection is true, to pass a list of pre-selected items when opening the dropdown.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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