0 purchases
desktop context menu
Spreadsheet with superpowers!
Desktop Context Menu #
A package that spawns a context menu at the mouse coordinates.
Available for MacOS and Windows.
MacOS
Windows
Features #
Native context menu
Separators between menu items
Specify shortcuts for menu items
Usage #
To invoke the context menu you can do the following:
final selectedItem = await showContextMenu(menuItems: [...]);
copied to clipboard
In case an item is selected in the context menu, that item is returned. If no item is selected, null is returned.
A context menu item can be of type ContextMenuItem or ContextMenuSeparator.
To define a menu item of type ContextMenuItem, you can do the following:
...
ContextMenuItem(
title: 'Menu item title',
onTap: () {
// do something...
},
),
...
copied to clipboard
If you do not set the onTap callback, the menu item will be disabled.
To add a separator between menu items, you need to add a ContextMenuSeparator between ContextMenuItems:
...
menuItems: [
ContextMenuItem(
title: 'Menu item title',
onTap: () {
// do something...
},
),
ContextMenuSeparator(),
ContextMenuItem(
title: 'Disabled menu item',
),
],
...
copied to clipboard
To define a shortcut for a menu item, just specify the shortcut property of ContextMenuItem that takes a SingleActivator:
...
ContextMenuItem(
title: 'Copy',
onTap: () {
// do something...
},
shortcut: SingleActivator(
LogicalKeyboardKey.keyC,
meta: Platform.isMacOS,
control: Platform.isWindows,
),
),
...
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.