CNActionSheet class

A native iOS action sheet.

On iOS this presents a real UIAlertController in UIAlertController.Style.actionSheet, so the sheet is the system control: system destructive red, the detached cancel row, VoiceOver, Dynamic Type, and — on iOS 26 — the Liquid Glass appearance, which the system applies with no opt-in. Because the appearance comes from the OS, the native path is used on every supported iOS version rather than being gated on iOS 26.

On every other platform the sheet falls back to a CupertinoActionSheet presented through CNBottomSheet.showModalPopup, which keeps the geometry probe the package relies on to hide platform views behind modals.

Basic usage

final choice = await CNActionSheet.show<String>(
  context: context,
  title: 'Delete photo?',
  message: 'This cannot be undone.',
  actions: const [
    CNActionSheetAction(
      label: 'Delete',
      value: 'delete',
      isDestructive: true,
    ),
    CNActionSheetAction(label: 'Duplicate', value: 'duplicate'),
  ],
  cancelLabel: 'Cancel',
);

if (choice == 'delete') _deletePhoto();

Anchoring

Starting in iOS 26 an action sheet anchors to the view it came from on iPhone as well as iPad, appearing directly over that view. Pass anchorRect — the global rect of the widget that triggered the sheet — to get that presentation and its transition. Omitting it is still valid: the system centres the sheet, and from iOS 26 gives it a cancel button. Below iOS 26 the centred sheet shows only the actions you passed, so supply a cancelLabel there.

final box = _buttonKey.currentContext!.findRenderObject()! as RenderBox;
final rect = box.localToGlobal(Offset.zero) & box.size;

await CNActionSheet.show<String>(
  context: context,
  anchorRect: rect,
  actions: const [CNActionSheetAction(label: 'Share', value: 'share')],
);

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

show<T>({required BuildContext context, required List<CNActionSheetAction<T>> actions, String? title, String? message, String? cancelLabel, Rect? anchorRect}) → Future<T?>
Presents the action sheet and resolves to the selected action's CNActionSheetAction.value.