GlassContextMenu class

A menu that a long press (or a right-click) on child opens, as iOS's context menus: the child lifts out of a blurred, dimmed page and a menu of items opens below it, or above it when there's no room.

A finger held down after the menu opens can slide onto a row and let go to choose it. A tap outside or the Escape key closes the menu.

The lifted preview builds child a second time, in the app's overlay; give a previewBuilder to show something else, such as a larger image.

Inheritance

Constructors

GlassContextMenu.new({Key? key, required Widget child, required List<GlassMenuEntry> items, WidgetBuilder? previewBuilder, String semanticLabel = 'Menu', bool enabled = true, double menuWidth = 250, ValueChanged<bool>? onOpenChanged})
Creates a context menu around child.
const

Properties

child → Widget
The widget a long press or right-click opens the menu from.
final
enabled → bool
Whether a long press opens the menu.
final
hashCode → int
The hash code for this object.
no setterinherited
items → List<GlassMenuEntry>
The rows: GlassMenuItems and GlassMenuSeparators.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
The widest the menu grows to.
final
onOpenChanged → ValueChanged<bool>?
Called as the menu opens and closes. Not called when the menu is removed from the tree while open.
final
previewBuilder → WidgetBuilder?
Builds what lifts out of the page. Defaults to child at its own size.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String
Names the menu for assistive technology.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<GlassContextMenu>
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