flutter_desktop_context_menu 0.2.0 copy "flutter_desktop_context_menu: ^0.2.0" to clipboard
flutter_desktop_context_menu: ^0.2.0 copied to clipboard

This plugin allows Flutter desktop apps to create native context menus.

Desktop Context Menu #

pub version

A package that spawns a context menu at the mouse coordinates.

Available for MacOS, Windows and Linux.

Hotkeys available only for MacOS.


Platform Support #

Linux macOS Windows
✔️ ✔️ ✔️

Screenshots #

macOS Linux Windows

Quick Start #

Installation #

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

dependencies:
  flutter_desktop_context_menu: ^0.2.0

Usage #

import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_desktop_context_menu/flutter_desktop_context_menu.dart';

Menu menu = Menu(
  items: [
    MenuItem(
      label: 'Copy',
      shortcutKey: 'c',
      shortcutModifiers: ShortcutModifiers(
        control: Platform.isWindows, meta: Platform.isMacOS),
      onClick: (_) {
        print('Clicked Copy');
      },
    ),
    MenuItem(
      label: 'Disabled item',
      disabled: true,
    ),
     MenuItem.checkbox(
      key: 'checkbox1',
      label: 'Checkbox1',
      toolTip: 'Checkbox 1',
      checked: true,
      onClick: (menuItem) {
        print('Clicked Checkbox1');
        menuItem.checked = !(menuItem.checked == true);
      },
    ),
    MenuItem.separator(),
  ],
);

popUpContextualMenu(
  menu,
  placement: Placement.bottomLeft,
);

Please see the example app of this plugin for a full example.

License #

MIT

5
likes
140
points
82
downloads

Publisher

verified publisherbiblescripture.ru

Weekly Downloads

This plugin allows Flutter desktop apps to create native context menus.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_desktop_context_menu