menu_base

pub version

Used to create context or tray menus.


Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  menu_base: ^0.1.0

Or

dependencies:
  window_manager:
    git:
      url: https://github.com/leanflutter/menu_base.git
      ref: main

Usage

import 'package:menu_base/menu_base.dart';

Menu menu = Menu(
  items: [
    MenuItem(
      label: 'Copy',
      onClick: (_) {
        BotToast.showText(text: 'Clicked Copy');
      },
    ),
    MenuItem(
      label: 'Disabled item',
      disabled: true,
    ),
    MenuItem.separator(),
    MenuItem.submenu(
      label: 'Submenu',
      submenu: Menu(
        items: [
          MenuItem.checkbox(
            key: 'checkbox1',
            label: 'Checkbox1',
            checked: true,
            onClick: (menuItem) {
              menuItem.checked = !(menuItem.checked == true);
            },
          ),
          MenuItem.checkbox(
            label: 'Checkbox2',
            checked: false,
          ),
          MenuItem.checkbox(
            label: 'Checkbox3',
            checked: null,
          ),
        ],
      ),
    ),
  ],
);

License

MIT

Libraries