Last updated:
0 purchases
native context menu fork
native_context_menu_fork #
Native context menu for flutter apps
Installation #
flutter pub add native_context_menu_fork
copied to clipboard
Usage #
import 'package:native_context_menu_fork/native_context_menu_fork.dart';
import 'package:flutter/material.dart';
void main() {
runApp(App());
}
class App extends StatefulWidget {
const App({Key? key}) : super(key: key);
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
String? action;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ContextMenuRegion(
onDismissed: () => setState(() => action = 'Menu was dismissed'),
onItemSelected: (item) => setState(() {
action = '${item.title} was selected';
}),
menuItems: [
MenuItem(title: 'First item'),
MenuItem(title: 'Second item'),
MenuItem(
title: 'Third item with submenu',
items: [
MenuItem(title: 'First subitem'),
MenuItem(title: 'Second subitem'),
MenuItem(title: 'Third subitem'),
],
),
MenuItem(title: 'Fourth item', checked: true),
],
child: Card(
child: Center(
child: Text(action ?? 'Right click me'),
),
),
),
),
);
}
}
copied to clipboard
Platform support #
Platform
Supported
MacOS
✅
Linux
✅
Windows
✅
License #
MIT
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.