BasePopupMenuButton class

A cross-platform popup menu button that adapts to the platform

Uses CNPopupMenuButton on iOS/macOS for native appearance with SF Symbols Uses Material PopupMenuButton on Android and other platforms

Example with icon button:

BasePopupMenuButton.icon(
  items: [
    BasePopupMenuItem(label: 'Edit', iconData: Icons.edit),
    BasePopupMenuItem(label: 'Delete', iconData: Icons.delete),
  ],
  onSelected: (index) => print('Selected item $index'),
  iosIcon: 'ellipsis',
  materialIcon: Icons.more_vert,
)

Example with label button:

BasePopupMenuButton(
  buttonLabel: 'Actions',
  items: [
    BasePopupMenuItem(label: 'New File', iconData: Icons.insert_drive_file),
    BasePopupMenuItem(label: 'New Folder', iconData: Icons.folder),
  ],
  onSelected: (index) => print('Selected item $index'),
)
Inheritance

Constructors

BasePopupMenuButton({Key? key, required List<BasePopupMenuItem> items, required ValueChanged<int> onSelected, String? buttonLabel, IconData? materialIcon, String? iosIcon, CNButtonStyle? buttonStyle, double size = 44.0, bool enabled = true, String? tooltip, bool useCNPopupMenuButton = true, BaseParam? baseParam})
const
BasePopupMenuButton.icon({Key? key, required List<BasePopupMenuItem> items, required ValueChanged<int> onSelected, IconData? materialIcon = Icons.more_vert, String? iosIcon = 'ellipsis', CNButtonStyle? buttonStyle, double size = 44.0, bool enabled = true, String? tooltip, bool useCNPopupMenuButton = true, BaseParam? baseParam})
Creates an icon-style popup menu button
const

Properties

baseParam → BaseParam?
Personalization parameters, gets platform parameters first, then mode parameters
finalinherited
buttonLabel → String?
Label for the button (text style button)
final
buttonStyle → CNButtonStyle?
Button style for CNPopupMenuButton (iOS only) Options: CNButtonStyle.plain, CNButtonStyle.glass, CNButtonStyle.filled
final
enabled → bool
Whether the button is enabled
final
hashCode → int
The hash code for this object.
no setterinherited
iosIcon → String?
iOS SF Symbol name (used on iOS/macOS)
final
items → List<BasePopupMenuItem>
List of menu items to display
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
materialIcon → IconData?
Material Design icon (used on Android)
final
onSelected → ValueChanged<int>
Called when a menu item is selected, provides the index
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → double
Size of the button (used for icon button)
final
tooltip → String?
Tooltip text for the button
final
useCNPopupMenuButton → bool
Use CNPopupMenuButton on iOS/macOS (default: true) Set to false to force Material PopupMenuButton on all platforms
final

Methods

beforeBuild(BuildContext context) → void
Called before build
inherited
beforeBuildByCupertino(BuildContext context) → void
Called before buildByCupertino
inherited
beforeBuildByCupertinoNative(BuildContext context) → void
Called before buildByCupertinoNative (native iOS implementation)
inherited
beforeBuildByMaterial(BuildContext context) → void
Called before buildByMaterial
inherited
build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
inherited
buildByCupertino(BuildContext context) → Widget
build on cupertino mode (Flutter implementation)
buildByCupertinoNative(BuildContext context) → dynamic
build on cupertino mode with native iOS components (cupertino_native package) This is called when baseParam.nativeIOS = true Default implementation falls back to buildByCupertino()
inherited
buildByMaterial(BuildContext context) → Widget
build on material mode
commonBuild(BuildContext context, BaseParam? baseParam) → dynamic
inherited
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
getBuildMode(BaseParam? baseParam) → WidgetBuildMode
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
valueOf(String key, dynamic value) → dynamic
inherited
valueOfBaseParam(BaseParam? baseParam, String key, dynamic value) → dynamic
No reflection available in Dart First get value from platform, then from mode, finally from value itself
inherited

Operators

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