Displays a menu when pressed and calls onSelected when the menu is dismissed because an item was selected. The value passed to onSelected is the value of the selected menu item. If child is null then a standard 'navigation/more_vert' icon is created.
- Inheritance
- Object
- Widget
- StatefulWidget
- PopupMenuButton
Constructors
- PopupMenuButton({Key key, @required PopupMenuItemBuilder<T> itemBuilder, T initialValue, PopupMenuItemSelected<T> onSelected, String tooltip: 'Show menu', int elevation: 8, EdgeInsets padding: const EdgeInsets.all(8.0), Widget child })
-
Creates a button that shows a popup menu.
Properties
- child → Widget
-
The widget below this widget in the tree.
read-only - elevation → int
-
The z-coordinate at which to place the menu when open.
read-only - initialValue → T
-
The value of the menu item, if any, that should be highlighted when the menu opens.
read-only - itemBuilder → PopupMenuItemBuilder<T>
-
Called when the button is pressed to create the items to show in the menu.
read-only - onSelected → PopupMenuItemSelected<T>
-
Called when the user selects a value from the popup menu created by this button.
read-only - padding → EdgeInsets
-
Matches IconButton's 8 dps padding by default. In some cases, notably where this button appears as the trailing element of a list item, it's useful to be able to set the padding to zero.
read-only - tooltip → String
-
Text that describes the action that will occur when the button is pressed.
read-only - hashCode → int
-
Get a hash code for this object.
read-only, inherited - key → Key
-
Controls how one widget replaces another widget in the tree.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
createState(
) → _PopupMenuButtonState<T> -
Creates the mutable state for this widget at a given location in the tree.
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited -
debugFillDescription(
List<String> description) → void -
Add additional information to the given description for use by toString.
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
toStringShort(
) → String -
A short, textual description of this widget.
inherited