OverflowMenu

Overview

Use the overflow menu component when additional options are available to the user but there is a space constraint.

Widget API

The CTextField widget parameters are identical to the normal TextField widget, however, it also has some extra parameters:

PropertyDescription

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

Example

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: (){ }
        ),
    ],
);

Last updated