上下文菜单
此插件允许 Flutter 桌面应用程序创建原生上下文菜单。
- 星标
- 88
- 复刻
- 13
- 最近推送(UTC)
- 2025年11月1日
- 项目状态
- 已归档
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
⚠️ Migration Notice: This plugin is being migrated to libnativeapi/nativeapi-flutter
The new version is based on a unified C++ core library (libnativeapi/nativeapi), providing more complete and consistent cross-platform native API support.
contextual_menu
This plugin allows Flutter desktop apps to create native context menus.
English | 简体中文
Platform Support
| Linux | macOS | Windows |
|---|---|---|
| ✔️ | ✔️ | ✔️ |
Screenshots
| macOS | Linux | Windows |
|---|---|---|
![]() |
![]() |
![]() |
Quick Start
Installation
Add this to your package's pubspec.yaml file:
dependencies:
contextual_menu: ^0.1.2
Or
dependencies:
contextual_menu:
git:
url: https://github.com/leanflutter/contextual_menu.git
ref: main
Usage
import 'package:flutter/material.dart' hide MenuItem;
import 'package:contextual_menu/contextual_menu.dart';
Menu menu = Menu(
items: [
MenuItem(
label: 'Copy',
onClick: (_) {
print('Clicked Copy');
},
),
MenuItem(
label: 'Disabled item',
disabled: true,
),
MenuItem.checkbox(
key: 'checkbox1',
label: 'Checkbox1',
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.
Who's using it?
- Biyi (比译) - A convenient translation and dictionary app.
Related Links
- https://github.com/leanflutter/menu_base
License
语言C++CMakeDartSwiftCRuby
使用的依赖
依赖清单 5 项
- flutter
{"sdk":"flutter"} - menu_base
^0.1.1 - flutter_test开发依赖
{"sdk":"flutter"} - flutter_lints开发依赖
^2.0.0 - dependency_validator开发依赖
^3.0.0
如何选择适合项目的代码仓?
先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
- 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
- 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
- 使用前在 GitHub 核对 README、许可证与 Issues。
来源与维护
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗


