EasyDropdown class
A widget that provides dropdown functionality.
The EasyDropdown widget wraps an existing child widget and adds the ability to display a dropdown list of items when activated. It is typically used to create dropdown menus.
Example usage:
EasyDropdown(
key: _dropDownKey, // GlobalKey<EasyDropdownState>
config: const EasyDropdownConfig(
radius: 16,
),
items: Future.sync(() async {
await Future.delayed(const Duration(seconds: 2));
return [
EasyDropdownTile(title: 'Test', onPressed: () {}),
EasyDropdownTile(title: 'Test 1', onPressed: () {}),
EasyDropdownTile(title: 'Test 2', onPressed: () {}),
];
}),
// items: [
// EasyDropdownTile(title: 'Test', onPressed: () {}),
// EasyDropdownTile(title: 'Test 1', onPressed: () {}),
// EasyDropdownTile(title: 'Test 2', onPressed: () {}),
// ],
child: RaisedButton(
onPressed: () {
_dropDownKey.currentState?.showOverlay();
},
child: Text(
'A selected field',
),
),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- EasyDropdown
Constructors
-
EasyDropdown({Key? key, required Widget child, required FutureOr<
List< items, double? itemCount, EasyDropdownConfig config = const EasyDropdownConfig(), VoidCallback? onDropdownStart, VoidCallback? onDropdownEnd})EasyDropdownTile> > -
Creates an instance of EasyDropdown.
const
Properties
- child → Widget
-
The widget that triggers the dropdown when interacted with.
final
- config → EasyDropdownConfig
-
The configuration options for the appearance and behavior of the dropdown menu.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- itemCount → double?
-
The maximum number of items to display in the dropdown. If not provided,
all items are displayed.
final
-
items
→ FutureOr<
List< EasyDropdownTile> > -
The list of items to display in the dropdown.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onDropdownEnd → VoidCallback?
-
A callback that is invoked when the dropdown is closed.
final
- onDropdownStart → VoidCallback?
-
A callback that is invoked when the dropdown is opened.
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< EasyDropdown> -
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