ContextualMenu class
A widget that displays a contextual popup menu when tapped.
The menu is positioned relative to a target widget specified by targetWidgetKey.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ContextualMenu
Constructors
-
ContextualMenu({Key? key, required GlobalKey<
State< targetWidgetKey, required Widget child, required List<StatefulWidget> >ContextPopupMenuItem> items, Color? backgroundColor, Color? highlightColor, Color? lineColor, void onDismiss()?, bool dismissOnClickAway = true, void stateChanged(bool change)?, int maxColumns = 3, PreferredPosition? position}) -
Creates a ContextualMenu.
const
Properties
- backgroundColor → Color?
-
The background color of the popup menu.
final
- child → Widget
-
The child widget that triggers the contextual menu when tapped.
final
- dismissOnClickAway → bool
-
Whether the menu should dismiss when the user clicks outside of it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightColor → Color?
-
The highlight color of a selected popup menu item.
final
-
items
→ List<
ContextPopupMenuItem> -
The list of items to display in the popup menu.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- lineColor → Color?
-
The color of the line separator between menu items.
final
- maxColumns → int
-
The maximum number of columns to display in the popup menu grid.
final
- onDismiss → void Function()?
-
Callback triggered after the popup menu is dismissed.
final
- position → PreferredPosition?
-
The preferred position of the menu relative to the target widget.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stateChanged → void Function(bool change)?
-
Callback triggered when the menu's visibility state changes.
final
-
targetWidgetKey
→ GlobalKey<
State< StatefulWidget> > -
The global key of the target widget to which the popup menu is anchored.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ContextualMenu> -
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