super_context_menu 0.6.0 super_context_menu: ^0.6.0 copied to clipboard
Context menu for Flutter that can seamlesly transition to drag & drop on mobile. Uses system context menu on iOS, macOS and Linux.
Context Menu for Flutter #
Features #
-
Single context menu widget that works accross all desktop platforms, mobile platforms and web
-
Can transition to native drag & drop on Android & iOS
- Native context menu on iOS, macOS and Linux
- Flutter context menu on Android, Windows and Web
- Advanced features such as custom lift image, menu and drag preview, deferred menu items (lazy loading) and deferred menu preview
Getting started #
super_context_menu
uses Rust internally to implement low-level platform specific functionality. Rather than shipping prebuilt binaries with the plugin, Rust build is seamlessly integrated into the Flutter build process.
To use super_context_menu
, you will need to install Rust:
For macOS or Linux, execute the following command in Terminal.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
For Windows, you can use the Rust Installer.
In case you have Rust already installed, make sure to update it to latest version:
rustup update
That is it. The build integration will automatically install required Rust targets and other dependencies (NDK). This also means that first build might take a little bit longer.
Usage #
Basic example:
return ContextMenuWidget(
child: const Item(
child: Text('Base Context Menu'),
),
menuProvider: (_) {
return Menu(
children: [
MenuAction(title: 'Menu Item 2', callback: () {}),
MenuAction(title: 'Menu Item 3', callback: () {}),
MenuSeparator(),
Menu(title: 'Submenu', children: [
MenuAction(title: 'Submenu Item 1', callback: () {}),
MenuAction(title: 'Submenu Item 2', callback: () {}),
Menu(title: 'Nested Submenu', children: [
MenuAction(title: 'Submenu Item 1', callback: () {}),
MenuAction(title: 'Submenu Item 2', callback: () {}),
]),
]),
],
);
},
);
Running the example project #
Example project is available at super_context_menu/example
.
flutter pub global activate melos # if you don't have melos already installed
git clone https://github.com/superlistapp/super_native_extensions.git
cd super_native_extensions
melos bootstrap
After this you can open the folder in VSCode and run the super_context_menu_example
launcher configuration.