CNPopupMenuSubmenu class

An entry that opens a nested menu of items, or shows them in place (see style).

On iOS it is a UIMenu nested in the button's menu, on macOS an NSMenuItem with a submenu, and in the CupertinoActionSheet fallback a row that opens a second sheet. Submenus can contain submenus.

Selecting an item inside it calls CNPopupMenuButton.onPathSelected with the item's full path, and CNPopupMenuButton.onSelected with the index of the top-level entry the item is under.

Inheritance

Constructors

CNPopupMenuSubmenu({required String label, required List<CNPopupMenuEntry> items, String? subtitle, CNSymbol? icon, IconData? customIcon, CNImageAsset? imageAsset, Color? iconColor, bool enabled = true, CNPopupMenuSubmenuStyle style = CNPopupMenuSubmenuStyle.nested, CNPopupMenuElementSize elementSize = CNPopupMenuElementSize.automatic})
Creates an entry that opens a nested menu.
const

Properties

customIcon → IconData?
Optional custom icon from CupertinoIcons, Icons, or any IconData. If provided, this takes precedence over icon but not imageAsset.
final
elementSize → CNPopupMenuElementSize
The size of the items (iOS 16+), mostly for CNPopupMenuSubmenuStyle.inline sections. Ignored on macOS and in the action sheet fallback.
final
enabled → bool
Whether the nested menu can be opened. A disabled submenu is shown greyed out, like a disabled item.
final
hashCode → int
The hash code for this object.
no setterinherited
icon → CNSymbol?
Optional SF Symbol shown before the label. Priority: imageAsset > customIcon > icon
final
iconColor → Color?
Optional color for custom icons. This applies a tint color to the custom icon. For SF Symbols, use the icon's color parameter instead.
final
imageAsset → CNImageAsset?
Optional image asset (SVG, PNG, etc.) shown before the label. If provided, this takes precedence over icon and customIcon.
final
items → List<CNPopupMenuEntry>
Entries of the nested menu: items, dividers and further submenus.
final
label → String
Display label for the submenu entry, also used as the nested menu's title.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
style → CNPopupMenuSubmenuStyle
Whether the items open as a nested menu, or show in the parent menu as a section or a row of icons. Inline and palette items report the same paths as nested ones. In the action sheet fallback they are listed in place under the label.
final
subtitle → String?
Optional second line shown under the label.
final

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