CupertinoContextMenu class

A full-screen modal route that opens when the child is long-pressed.

When open, the CupertinoContextMenu shows the child in a large full-screen Overlay with a list of buttons specified by actions. The child/preview is placed in an Expanded widget so that it will grow to fill the Overlay if its size is unconstrained.

When closed, the CupertinoContextMenu displays the child as if the CupertinoContextMenu were not there. Sizing and positioning is unaffected. The menu can be closed like other PopupRoutes, such as by tapping the background or by calling Navigator.pop(context). Unlike PopupRoute, it can also be closed by swiping downwards.

This sample shows a very simple CupertinoContextMenu for the Flutter logo. Long press on it to open.

To create a local project with this code sample, run:
flutter create --sample=cupertino.CupertinoContextMenu.1 mysample

This sample shows a similar CupertinoContextMenu, this time using builder to add a border radius to the widget.

To create a local project with this code sample, run:
flutter create --sample=cupertino.CupertinoContextMenu.2 mysample

See also:



CupertinoContextMenu({Key? key, required List<Widget> actions, required Widget child, bool enableHapticFeedback = false})
Create a context menu.
CupertinoContextMenu.builder({Key? key, required List<Widget> actions, required CupertinoContextMenuBuilder builder, bool enableHapticFeedback = false})
Creates a context menu with a custom builder controlling the widget.


actions List<Widget>
The actions that are shown in the menu.
builder CupertinoContextMenuBuilder
A function that returns a widget to be used alternatively from child.
child Widget?
The widget that can be "opened" with the CupertinoContextMenu.
enableHapticFeedback bool
If true, clicking on the CupertinoContextMenuActions will produce haptic feedback.
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
createState() State<CupertinoContextMenu>
Creates the mutable state for this widget at a given location in the tree.
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
toString({DiagnosticLevel minLevel =}) String
A string representation of this object.
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
toStringShort() String
A short, textual description of this widget.


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

Static Properties

animationOpensAt double
The point at which the CupertinoContextMenu begins to animate into the open position.


kEndBoxShadow → const List<BoxShadow>
Exposes the final box shadow of the opening animation of the child widget to match the default behavior of the native iOS widget. This value was eyeballed from the iOS simulator running iOS 16.0.
kOpenBorderRadius → const double
Exposes the default border radius for matching iOS 16.0 behavior. This value was eyeballed from the iOS simulator running iOS 16.0.