Skip to content

Commit 37ba77d

Browse files
committed
Release v0.1.0
1 parent ba4e916 commit 37ba77d

File tree

7 files changed

+325
-51
lines changed

7 files changed

+325
-51
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## 0.0.1
1+
## 0.1.0
22

3-
* TODO: Describe initial release.
3+
* First release.

LICENSE

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
TODO: Add your license here.
1+
MIT License
2+
3+
Copyright (c) 2022 LiJianying <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README-ZH.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# contextual_menu
2+
3+
[![pub version][pub-image]][pub-url] [![][discord-image]][discord-url]
4+
5+
[pub-image]: https://img.shields.io/pub/v/contextual_menu.svg
6+
[pub-url]: https://pub.dev/packages/contextual_menu
7+
8+
[discord-image]: https://img.shields.io/discord/884679008049037342.svg
9+
[discord-url]: https://discord.gg/zPa6EZ2jqb
10+
11+
这个插件允许 Flutter 桌面应用创建原生上下文菜单。
12+
13+
---
14+
15+
[English](./README.md) | 简体中文
16+
17+
---
18+
19+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
20+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
21+
22+
- [contextual_menu](#contextual_menu)
23+
- [平台支持](#平台支持)
24+
- [快速开始](#快速开始)
25+
- [安装](#安装)
26+
- [用法](#用法)
27+
- [谁在用使用它?](#谁在用使用它)
28+
- [相关链接](#相关链接)
29+
- [许可证](#许可证)
30+
31+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
32+
33+
## 平台支持
34+
35+
| Linux | macOS | Windows |
36+
| :---: | :---: | :-----: |
37+
| ✔️ | ✔️ | ✔️ |
38+
39+
## 快速开始
40+
41+
### 安装
42+
43+
将此添加到你的软件包的 pubspec.yaml 文件:
44+
45+
```yaml
46+
dependencies:
47+
contextual_menu: ^0.1.4
48+
```
49+
50+
51+
52+
```yaml
53+
dependencies:
54+
contextual_menu:
55+
git:
56+
url: https://github.com/leanflutter/contextual_menu.git
57+
ref: main
58+
```
59+
60+
### 用法
61+
62+
```dart
63+
import 'package:contextual_menu/contextual_menu.dart';
64+
65+
Menu menu = Menu(
66+
items: [
67+
MenuItem(
68+
label: 'Copy',
69+
onClick: (_) {
70+
print('Clicked Copy');
71+
},
72+
),
73+
MenuItem(
74+
label: 'Disabled item',
75+
disabled: true,
76+
),
77+
MenuItem.checkbox(
78+
key: 'checkbox1',
79+
label: 'Checkbox1',
80+
checked: true,
81+
onClick: (menuItem) {
82+
print('Clicked Checkbox1');
83+
menuItem.checked = !(menuItem.checked == true);
84+
},
85+
),
86+
MenuItem.separator(),
87+
],
88+
);
89+
90+
popUpContextualMenu(
91+
_menu!,
92+
placement: Placement.bottomLeft,
93+
);
94+
95+
```
96+
97+
> 请看这个插件的示例应用,以了解完整的例子。
98+
99+
## 谁在用使用它?
100+
101+
- [Biyi (比译)](https://biyidev.com/) - 一个便捷的翻译和词典应用。
102+
103+
## 相关链接
104+
105+
- https://github.com/leanflutter/menu_base
106+
107+
## 许可证
108+
109+
[MIT](./LICENSE)

README.md

Lines changed: 103 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,109 @@
11
# contextual_menu
22

3-
A new flutter plugin project.
3+
[![pub version][pub-image]][pub-url] [![][discord-image]][discord-url]
44

5-
## Getting Started
5+
[pub-image]: https://img.shields.io/pub/v/contextual_menu.svg
6+
[pub-url]: https://pub.dev/packages/contextual_menu
67

7-
This project is a starting point for a Flutter
8-
[plug-in package](https://flutter.dev/developing-packages/),
9-
a specialized package that includes platform-specific implementation code for
10-
Android and/or iOS.
8+
[discord-image]: https://img.shields.io/discord/884679008049037342.svg
9+
[discord-url]: https://discord.gg/zPa6EZ2jqb
1110

12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
11+
This plugin allows Flutter desktop apps to create native context menus.
1512

13+
---
14+
15+
English | [简体中文](./README-ZH.md)
16+
17+
---
18+
19+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
20+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
21+
22+
- [contextual_menu](#contextual_menu)
23+
- [Platform Support](#platform-support)
24+
- [Quick Start](#quick-start)
25+
- [Installation](#installation)
26+
- [Usage](#usage)
27+
- [Who's using it?](#whos-using-it)
28+
- [Related Links](#related-links)
29+
- [License](#license)
30+
31+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
32+
33+
## Platform Support
34+
35+
| Linux | macOS | Windows |
36+
| :---: | :---: | :-----: |
37+
| ✔️ | ✔️ | ✔️ |
38+
39+
## Quick Start
40+
41+
### Installation
42+
43+
Add this to your package's pubspec.yaml file:
44+
45+
```yaml
46+
dependencies:
47+
contextual_menu: ^0.1.4
48+
```
49+
50+
Or
51+
52+
```yaml
53+
dependencies:
54+
contextual_menu:
55+
git:
56+
url: https://github.com/leanflutter/contextual_menu.git
57+
ref: main
58+
```
59+
60+
### Usage
61+
62+
```dart
63+
import 'package:contextual_menu/contextual_menu.dart';
64+
65+
Menu menu = Menu(
66+
items: [
67+
MenuItem(
68+
label: 'Copy',
69+
onClick: (_) {
70+
print('Clicked Copy');
71+
},
72+
),
73+
MenuItem(
74+
label: 'Disabled item',
75+
disabled: true,
76+
),
77+
MenuItem.checkbox(
78+
key: 'checkbox1',
79+
label: 'Checkbox1',
80+
checked: true,
81+
onClick: (menuItem) {
82+
print('Clicked Checkbox1');
83+
menuItem.checked = !(menuItem.checked == true);
84+
},
85+
),
86+
MenuItem.separator(),
87+
],
88+
);
89+
90+
popUpContextualMenu(
91+
_menu!,
92+
placement: Placement.bottomLeft,
93+
);
94+
95+
```
96+
97+
> Please see the example app of this plugin for a full example.
98+
99+
## Who's using it?
100+
101+
- [Biyi (比译)](https://biyidev.com/) - A convenient translation and dictionary app.
102+
103+
## Related Links
104+
105+
- https://github.com/leanflutter/menu_base
106+
107+
## License
108+
109+
[MIT](./LICENSE)

example/lib/pages/home.dart

Lines changed: 73 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,107 @@ class _HomePageState extends State<HomePage> {
2828
_menu ??= Menu(
2929
items: [
3030
MenuItem(
31-
label: 'Copy',
32-
onClick: (_) {
33-
BotToast.showText(text: 'Clicked Copy');
34-
},
35-
),
36-
MenuItem(
37-
label: 'Paste',
38-
onClick: (_) {
39-
BotToast.showText(text: 'Clicked Paste');
40-
},
31+
label: 'Look Up "LeanFlutter"',
4132
),
4233
MenuItem(
43-
label: 'Paste as values',
34+
label: 'Search with Google',
4435
),
4536
MenuItem.separator(),
4637
MenuItem(
47-
label: 'Item number two',
38+
label: 'Cut',
4839
),
4940
MenuItem(
50-
label: 'Disabled item',
51-
disabled: true,
41+
label: 'Copy',
5242
),
5343
MenuItem(
54-
label: 'Disabled item with shortcut',
44+
label: 'Paste',
5545
disabled: true,
5646
),
47+
MenuItem.submenu(
48+
label: 'Share',
49+
submenu: Menu(
50+
items: [
51+
MenuItem(
52+
label: 'Item 1',
53+
),
54+
MenuItem(
55+
label: 'Item 2',
56+
),
57+
MenuItem.checkbox(
58+
label: 'Centered Layout',
59+
checked: false,
60+
),
61+
MenuItem.separator(),
62+
MenuItem.checkbox(
63+
label: 'Show Primary Side Bar',
64+
checked: true,
65+
),
66+
MenuItem.checkbox(
67+
label: 'Show Secondary Side Bar',
68+
checked: true,
69+
),
70+
MenuItem.checkbox(
71+
label: 'Show Status Bar',
72+
checked: true,
73+
),
74+
MenuItem.checkbox(
75+
label: 'Show Activity Bar',
76+
checked: true,
77+
),
78+
MenuItem.checkbox(
79+
label: 'Show Panel Bar',
80+
checked: false,
81+
),
82+
],
83+
),
84+
),
5785
MenuItem.separator(),
5886
MenuItem.submenu(
59-
label: 'Submenu',
87+
label: 'Font',
6088
submenu: Menu(
6189
items: [
6290
MenuItem.checkbox(
63-
key: 'checkbox1',
64-
label: 'Checkbox1',
91+
label: 'Item 1',
6592
checked: true,
6693
onClick: (menuItem) {
67-
BotToast.showText(text: 'Clicked Checkbox1');
6894
menuItem.checked = !(menuItem.checked == true);
6995
},
7096
),
7197
MenuItem.checkbox(
72-
label: 'Checkbox2',
98+
label: 'Item 2',
7399
checked: false,
100+
onClick: (menuItem) {
101+
menuItem.checked = !(menuItem.checked == true);
102+
},
74103
),
75-
MenuItem.checkbox(
76-
label: 'Checkbox3',
77-
checked: null,
104+
MenuItem.separator(),
105+
MenuItem(
106+
label: 'Item 3',
107+
checked: false,
108+
),
109+
MenuItem(
110+
label: 'Item 4',
111+
checked: false,
112+
),
113+
MenuItem(
114+
label: 'Item 5',
115+
checked: false,
78116
),
79117
],
80118
),
81119
),
82-
MenuItem.separator(),
83-
MenuItem(
84-
label: 'Control shortcut',
120+
MenuItem.submenu(
121+
label: 'Speech',
122+
submenu: Menu(
123+
items: [
124+
MenuItem(
125+
label: 'Item 1',
126+
),
127+
MenuItem(
128+
label: 'Item 2',
129+
),
130+
],
131+
),
85132
),
86133
],
87134
);

0 commit comments

Comments
 (0)