DropdownButton<T> class
A dropdown selector that lets the user choose one item from a list.
Displays the currently selected value and opens a popup menu when activated. Use hint to show placeholder text when no value is selected.
- Inheritance
-
- Object
- Widget
- StatefulWidget
- DropdownButton
Constructors
-
DropdownButton({Key? key, required List<
DropdownMenuItem< items, T? value, required ValueChanged<T> >T?> ? onChanged, String? hint, FocusNode? focusNode, Color? focusColor, Color? backgroundColor, Color? dropdownColor}) -
Creates a DropdownButton with the given
itemsandonChangedcallback.const
Properties
- backgroundColor → Color?
-
The background color of the closed button.
final
- dropdownColor → Color?
-
The background color of the dropdown menu popup.
final
- focusColor → Color?
-
The border color when the button has focus.
final
- focusNode → FocusNode?
-
An optional focus node for keyboard navigation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hint → String?
-
Placeholder text shown when no value is selected.
final
-
items
→ List<
DropdownMenuItem< T> > -
The list of menu items to choose from.
final
- key → Key?
-
Controls how one widget replaces another in the tree.
finalinherited
-
onChanged
→ ValueChanged<
T?> ? -
Called when the user selects a new item.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T?
-
The currently selected value, or
nullif nothing is selected.final
Methods
-
createElement(
) → StatefulElement -
Creates the Element for this widget.
inherited
-
createState(
) → State< DropdownButton< T> > -
Creates the mutable state for this widget.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited