SimpleDropdown<T> class

A widget that will display a dropdown menu when triggered. The dropdown menu will be built by DropdownMenuBuilderDelegate so that users can customize the menu.

Users can utilize DropdownController to:

  1. DropdownController.open to open the dropdown menu.
  2. DropdownController.dismiss to dismiss the dropdown menu.
  3. DropdownController.select to make an item as selected.

See also:

Inheritance

Constructors

SimpleDropdown({Key? key, required DropdownController<T> controller, required WidgetBuilder builder, required DropdownMenuBuilderDelegate<T> delegate, BoxConstraints? menuConstraints, BoxDecoration? menuDecoration, DropdownMenuPosition menuPosition = const DropdownMenuPosition(), bool crossAxisConstrained = true, bool dismissible = true, bool enabled = true, bool enableListen = true})
const
SimpleDropdown.custom({Key? key, required WidgetBuilder builder, required DropdownController<T> controller, required DropdownMenuBuilder<T> menuBuilder, BoxConstraints? menuConstraints, BoxDecoration? menuDecoration, bool enableListen = true, DropdownMenuPosition menuPosition = const DropdownMenuPosition(), bool crossAxisConstrained = true, bool dismissible = true, bool enabled = true})
SimpleDropdown.list({Key? key, required WidgetBuilder builder, required DropdownController<T> controller, BoxConstraints? menuConstraints, BoxDecoration? menuDecoration, bool enableListen = true, DropdownMenuPosition menuPosition = const DropdownMenuPosition(), bool crossAxisConstrained = true, bool dismissible = true, bool enabled = true, required MenuItemBuilder<T> itemBuilder, IndexedWidgetBuilder? separatorBuilder, WidgetBuilder? loadingBuilder, WidgetBuilder? emptyListBuilder})

Properties

builder WidgetBuilder
The widget that will be used to trigger the dropdown. It can be a button, a text field, or any other widget.
final
controller DropdownController<T>
The controller that will be used to manage the dropdown menu and items.
final
crossAxisConstrained bool
Whether the dropdown menu should be constrained by the cross axis of the dropdown trigger. It will work with menuConstraints to constrain the dropdown menu if applicable. It only takes effect when the menu is displaying.
final
delegate DropdownMenuBuilderDelegate<T>
Delegate that will be used to build the dropdown menu.
final
dismissible bool
Whether the dropdown menu should be dismissed when the user taps outside of both it and the dropdown button.
final
enabled bool
if true, the dropdown will be interactive automatically; otherwise, you need to call DropdownController.open and DropdownController.dismiss manually.
final
enableListen bool
Whether the dropdown button/trigger built from builder should listen to the controller. As a result, the button builder will be rebuilt when DropdownController changes, like selected items
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
The constraints that will be used to constrain the dropdown menu. It only takes effect when the menu is displaying. It will work with crossAxisConstrained to constrain the dropdown menu if applicable.
final
The decoration that will be used to decorate the dropdown menu. It only takes effect when the menu is displaying.
final
The position that will be used to position the dropdown menu.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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