ContextMenuState class

Manages the state of the context menu.

This class is used to manage the state of the context menu. It provides methods to show and hide the context menu, and to update the position of the context menu.

Inheritance

Constructors

ContextMenuState({required ContextMenu menu, ContextMenuItem? parentItem})
ContextMenuState.submenu({required ContextMenu menu, required VoidCallback? selfClose, ContextMenuItem? parentItem, AlignmentGeometry? spawnAlignmen, Rect? parentItemRect})

Properties

borderRadius BorderRadiusGeometry?
no setter
boxDecoration BoxDecoration?
no setter
clipBehavior Clip
no setter
entries List<ContextMenuEntry>
no setter
focusedEntry ContextMenuEntry?
no setter
focusScopeNode FocusScopeNode
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isPositionVerified bool
no setter
isSubmenu bool
no setter
isSubmenuOpen bool
no setter
maxWidth double
no setter
final
overlayController OverlayPortalController
final
padding EdgeInsets
no setter
parentItem ContextMenuItem?
final
parentItemRect Rect?
no setter
position Offset
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedItem ContextMenuItem?
no setter
selfClose VoidCallback?
final
shortcuts Map<ShortcutActivator, VoidCallback>
no setter
spawnAlignment AlignmentGeometry
no setter
getter/setter pair

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
close() → void
Closes the context menu and removes the overlay.
closeSubmenu() → void
Closes the current submenu and removes the overlay.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
isFocused(ContextMenuEntry entry) bool
Determines whether the entry is focused.
isOpened(ContextMenuItem item) bool
Determines whether the entry is opened as a submenu.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setFocusedEntry(ContextMenuEntry? value) → void
setSelectedItem(ContextMenuItem? value) → void
setSpawnAlignment(AlignmentGeometry value) → void
showSubmenu({required BuildContext context, required ContextMenuItem parent}) → void
Shows the submenu at the specified position.
toString() String
A string representation of this object.
inherited
verifyPosition(BuildContext context) → void
Verifies the position of the context menu and updates it if necessary.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

of(BuildContext context) ContextMenuState