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

Constructors

PopupMenuButton({Key key, PopupMenuItemBuilder<T> itemBuilder, T initialValue, PopupMenuItemSelected<T> onSelected, String tooltip: 'Show menu', double elevation: 8.0, EdgeInsets padding: const EdgeInsets.all(8.0), Widget child })

Creates a button that shows a popup menu.

const

Properties

child Widget

The widget below this widget in the tree.

final
elevation double

The z-coordinate at which to place the menu when open.

final
initialValue → T

The value of the menu item, if any, that should be highlighted when the menu opens.

final
itemBuilder PopupMenuItemBuilder<T>

Called when the button is pressed to create the items to show in the menu.

final
onSelected PopupMenuItemSelected<T>

Called when the user selects a value from the popup menu created by this button.

final
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.

final
tooltip String

Text that describes the action that will occur when the button is pressed.

final
hashCode int

The hash code for this object.

read-only, inherited
key Key

Controls how one widget replaces another widget in the tree.

final, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, 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.

@mustCallSuper, @protected, 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

Operators

operator ==(other) bool

The equality operator.

inherited