OverflowMenu
Last updated
Last updated
Use the overflow menu component when additional options are available to the user but there is a space constraint.
The CTextField
widget parameters are identical to the normal TextField
widget, however, it also has some extra parameters:
controller
An object that is used to control the menu.
Type: COverflowMenuController
Default: required
items
A list of COverflowMenuItem
to display in a column when the menu is open.
Type: List<COverflowMenuItem>
Default: required
child
The child contained by the menu.
Type: Widget
Default: required
onOpen
A method called after the menu is open.
Type: VoidCallback?
Default: optional
onClose
A method called after the menu is closed.
Type: VoidCallback?
Default: optional
barrierDismissible
Whether you can close the menu by tapping the barrier.
Type: bool
Default: true
menuOffset
The adjustment in the position applied to the menu.
Type: Offset
Default: Offset.zero
size
The size of this menu. It can be regular
, sm
, or md
.
Type: COverflowMenuSize
Default: COverflowMenuSize.md
child
The content of the item.
Type: Widget
Default: required
onTap
Called when the item is tapped.
Type: VoidCallback?
Default: optional
enable
Whether the item is enabled or not.
Type: bool
Default: true
hasDivider
Whether this item has a divider.
Type: bool
Default: false
isDelete
To make this menu item a danger ghost button.
Type: bool
Default: false
icon
The icon of the button.
Type: Widget
Default: required
items
A list of COverflowMenuItem
to display in a column when the menu is open.
Type: List<COverflowMenuItem>
Default: required
enable
Whether the button is enabled or not.
Type: bool
Default: true
barrierDismissible
Whether you can close the menu by tapping the barrier.
Type: bool
Default: true
onClose
A method called after the menu is closed.
Type: VoidCallback?
Default: optional
onOpen
A method called after the menu is open.
Type: VoidCallback?
Default: optional
menuOffset
The adjustment in the position applied to the menu.
Type: Offset
Default: Offset.zero
size
The size of this menu. It can be regular
, sm
, or md
.
Type: COverflowMenuSize
Default: COverflowMenuSize.md
COverflowMenu(
controller: controller,
child: CButton(
label: 'Menu Button',
onTap: () {
controller.open()
},
),
items: [
COverflowMenuItem(
child: CText(data:'hello'),
onTap: (){ }
),
COverflowMenuItem(
isDelete: true,
child: CText(data:'hello'),
onTap: (){ }
),
],
);
// -----
COverflowMenuButton(
icon: Icon(CIcons.add),
items: [
COverflowMenuItem(
child: CText(data:'hello'),
onTap: (){ }
),
COverflowMenuItem(
isDelete: true,
child: CText(data:'hello'),
onTap: (){ }
),
],
);