PopupMenu<T> class

Create a customized PopupMenuButton.

Inheritance
Available extensions

Constructors

PopupMenu({Key? key, List<T>? items, List<PopupMenuEntry<T>>? menuEntries, PopupMenuItemBuilder<T>? itemBuilder, T? initialValue, PopupMenuItemSelected<T>? onSelected, PopupMenuCanceled? onCanceled, String? tooltip, double? elevation, EdgeInsetsGeometry? padding, double? splashRadius, Widget? child, Widget? icon, double? iconSize, Offset? offset, bool? enabled, ShapeBorder? shape, Color? color, bool? enableFeedback, BoxConstraints? constraints, PopupMenuPosition? position, String? inTooltip()?, double? inElevation()?, EdgeInsetsGeometry? inPadding()?, double? inSplashRadius()?, Widget? inChild()?, Widget? inIcon()?, double? inIconSize()?, Offset? inOffset()?, bool? inEnabled()?, ShapeBorder? inShape()?, Color? inColor()?, bool? inEnableFeedback()?, BoxConstraints? inConstraints()?, PopupMenuPosition? inPosition()?})
Supply all the properties to instantiate a custom PopupMenuButton.
const

Properties

child Widget?
If provided, child is the widget used for this button
final
color Color?
If provided, the background color used for the menu.
final
constraints BoxConstraints?
Optional size constraints for the menu.
final
elevation double?
The z-coordinate at which to place the menu when open. This controls the size of the shadow below the menu.
final
enabled bool?
Whether this popup menu button is interactive.
final
enableFeedback bool?
Whether detected gestures should provide acoustic and/or haptic feedback.
final
hashCode int
The hash code for this object.
no setterinherited
icon Widget?
If provided, the icon is used for this button
final
iconSize double?
The size of the icon.
final
inChild Widget? Function()?
'in Parameters' function
final
inColor Color? Function()?
'in Parameters' function
final
inConstraints BoxConstraints? Function()?
'in Parameters' function
final
inElevation double? Function()?
'in Parameters' function
final
inEnabled bool? Function()?
'in Parameters' function
final
inEnableFeedback bool? Function()?
'in Parameters' function
final
inIcon Widget? Function()?
'in Parameters' function
final
inIconSize double? Function()?
'in Parameters' function
final
initialValue → T?
The value of the menu item, if any, that should be highlighted when the menu opens.
final
inOffset Offset? Function()?
'in Parameters' function
final
inPadding EdgeInsetsGeometry? Function()?
'in Parameters' function
final
inPosition PopupMenuPosition? Function()?
'in Parameters' function
final
inShape ShapeBorder? Function()?
'in Parameters' function
final
inSplashRadius double? Function()?
'in Parameters' function
final
inTooltip String? Function()?
'in Parameters' function
final
itemBuilder PopupMenuItemBuilder<T>?
The item builder if no List is available.
final
items List<T>?
List of menu items to appear in the popup menu.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
Optional list of PopupMenuEntries to appear in the popup menu.
final
Optional list of PopupMenuEntries to appear in the popup menu. Initialized only when the getter is accessed!
no setter
offset Offset?
The offset applied to the Popup Menu Button. When not set, the Popup Menu Button will be positioned directly next to the button that was used to create it.
final
onCanceled PopupMenuCanceled?
Called when the user dismisses the popup menu without selecting an item.
final
onSelected PopupMenuItemSelected<T>?
Called when a menu item is selected.
final
padding EdgeInsetsGeometry?
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
position PopupMenuPosition?
Whether the popup menu is positioned over or under the popup menu button.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape ShapeBorder?
If provided, the shape used for the menu.
final
splashRadius double?
The splash radius.If null, default splash radius of InkWell or IconButton is used.
final
tooltip String?
Text that describes the action that will occur when the button is pressed.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
canceled() → void
Called when the user dismisses the popup menu without selecting an item.
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
onChild() Widget?
The widget used for this button
onColor() Color?
The background color used for the menu
onConstraints() BoxConstraints?
Make the menu wider than the default maximum width
onElevation() double?
This controls the size of the shadow below the menu.
onEnabled() bool?
Whether this popup menu button is interactive
onEnableFeedback() bool?
Whether detected gestures should provide acoustic and/or haptic feedback
onIcon() Widget?
The icon is used for this button
onIconSize() double?
the size of the Icon.
onInitialValue() → T?
The value of the menu item, if any, that should be highlighted when the menu opens.
onItemBuilder(BuildContext context) List<PopupMenuEntry<T>>
onItems() List<T>?
List of menu items to appear in the popup menu.
onOffset() Offset?
The offset is applied relative to the initial position
onPadding() EdgeInsetsGeometry?
In some cases, it's useful to be able to set the padding to zero.
onPosition() PopupMenuPosition?
Whether the menu is positioned over or under the popup menu button PopupMenuPosition.over or PopupMenuPosition.under
onShape() ShapeBorder?
The shape used for the menu
onSplashRadius() double?
The splash radius. If null, default splash radius of InkWell or IconButton is used.
onTooltip() String?
Text that describes the action that will occur when the button is pressed.
selected(T value) → void
Called when the user selects a value from the popup menu created by this button.
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