Home

Awesome

menu_base

pub version

Used to create context or tray menus.


<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->

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:flutter/material.dart' hide MenuItem;
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,
          ),
        ],
      ),
    ),
  ],
);

Related Links

License

MIT