flu-cli-core 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -13
- package/dist/index.cjs +2263 -1181
- package/dist/index.d.cts +87 -10
- package/dist/index.d.ts +87 -10
- package/dist/index.js +2143 -1071
- package/package.json +7 -2
- package/templates/snippets/flu-cli.code-snippets +35 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flu-cli-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Core logic for flu-cli",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -35,8 +35,13 @@
|
|
|
35
35
|
],
|
|
36
36
|
"author": "火叶工作室",
|
|
37
37
|
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://gitee.com/flu-cli/flu-cli.git",
|
|
41
|
+
"directory": "packages/core"
|
|
42
|
+
},
|
|
38
43
|
"dependencies": {
|
|
39
|
-
"@huoye/app-ship": "^0.1.
|
|
44
|
+
"@huoye/app-ship": "^0.1.2",
|
|
40
45
|
"axios": "^1.13.2",
|
|
41
46
|
"chalk": "^4.1.2",
|
|
42
47
|
"form-data": "^4.0.5",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"body": [
|
|
14
14
|
"import 'package:flutter/material.dart';",
|
|
15
15
|
"import '${relative_core_path}';",
|
|
16
|
-
"import '
|
|
16
|
+
"import '${vm_import}';",
|
|
17
17
|
"",
|
|
18
|
-
"class ${2:Name}Page extends
|
|
18
|
+
"class ${2:Name}Page extends ${base_page}<${2:Name}ViewModel> {",
|
|
19
19
|
" const ${2:Name}Page({super.key});",
|
|
20
20
|
"",
|
|
21
21
|
" @override",
|
|
22
22
|
" State<${2:Name}Page> createState() => _${2:Name}PageState();",
|
|
23
23
|
"}",
|
|
24
24
|
"",
|
|
25
|
-
"class _${2:Name}PageState extends
|
|
25
|
+
"class _${2:Name}PageState extends ${base_page}State<${2:Name}ViewModel, ${2:Name}Page> {",
|
|
26
26
|
" // ==================== UI 配置 ====================",
|
|
27
27
|
" @override",
|
|
28
28
|
" String get title => '${3:Title}';",
|
|
@@ -105,13 +105,36 @@
|
|
|
105
105
|
"",
|
|
106
106
|
],
|
|
107
107
|
},
|
|
108
|
+
"flu.vm": {
|
|
109
|
+
"prefix": "vm",
|
|
110
|
+
"description": "ViewModel(使用 BaseViewModel)",
|
|
111
|
+
"body": [
|
|
112
|
+
"import '${relative_core_path}';",
|
|
113
|
+
"",
|
|
114
|
+
"class ${1:Name}ViewModel extends ${base_viewmodel} {",
|
|
115
|
+
" /// 初始化",
|
|
116
|
+
" @override",
|
|
117
|
+
" Future<void> onInit() async {",
|
|
118
|
+
" await super.onInit();",
|
|
119
|
+
" // TODO: 初始化逻辑",
|
|
120
|
+
" }",
|
|
121
|
+
"",
|
|
122
|
+
" /// 刷新数据",
|
|
123
|
+
" @override",
|
|
124
|
+
" Future<void> refreshData() async {",
|
|
125
|
+
" // TODO: 刷新逻辑",
|
|
126
|
+
" }",
|
|
127
|
+
"}",
|
|
128
|
+
"",
|
|
129
|
+
],
|
|
130
|
+
},
|
|
108
131
|
"flu.viewmodel": {
|
|
109
132
|
"prefix": "viewmodel",
|
|
110
133
|
"description": "ViewModel(使用 BaseViewModel)",
|
|
111
134
|
"body": [
|
|
112
135
|
"import '${relative_core_path}';",
|
|
113
136
|
"",
|
|
114
|
-
"class ${1:Name}ViewModel extends
|
|
137
|
+
"class ${1:Name}ViewModel extends ${base_viewmodel} {",
|
|
115
138
|
" /// 初始化",
|
|
116
139
|
" @override",
|
|
117
140
|
" Future<void> onInit() async {",
|
|
@@ -164,17 +187,17 @@
|
|
|
164
187
|
"body": [
|
|
165
188
|
"import 'package:flutter/material.dart';",
|
|
166
189
|
"import '${relative_core_path}';",
|
|
167
|
-
"import '
|
|
168
|
-
"import '
|
|
190
|
+
"import '${vm_import}';",
|
|
191
|
+
"import '${model_import}';",
|
|
169
192
|
"",
|
|
170
|
-
"class ${2:Name}Page extends
|
|
193
|
+
"class ${2:Name}Page extends ${base_page}<${4:ModelName}, ${2:Name}ViewModel> {",
|
|
171
194
|
" const ${2:Name}Page({super.key});",
|
|
172
195
|
"",
|
|
173
196
|
" @override",
|
|
174
197
|
" State<${2:Name}Page> createState() => _${2:Name}PageState();",
|
|
175
198
|
"}",
|
|
176
199
|
"",
|
|
177
|
-
"class _${2:Name}PageState extends
|
|
200
|
+
"class _${2:Name}PageState extends ${base_page}State<${4:ModelName}, ${2:Name}ViewModel, ${2:Name}Page> {",
|
|
178
201
|
" @override",
|
|
179
202
|
" String get title => '${5:Title}';",
|
|
180
203
|
"",
|
|
@@ -196,9 +219,9 @@
|
|
|
196
219
|
"description": "List ViewModel (BaseListViewModel)",
|
|
197
220
|
"body": [
|
|
198
221
|
"import '${relative_core_path}';",
|
|
199
|
-
"import '
|
|
222
|
+
"import '${model_import}';",
|
|
200
223
|
"",
|
|
201
|
-
"class ${2:Name}ViewModel extends
|
|
224
|
+
"class ${2:Name}ViewModel extends ${base_viewmodel}<${1:ModelName}> {",
|
|
202
225
|
" @override",
|
|
203
226
|
" Future<List<${1:ModelName}>> fetchPage({required int page, required int pageSize}) async {",
|
|
204
227
|
" // TODO: Load data from service",
|
|
@@ -213,24 +236,10 @@
|
|
|
213
236
|
"prefix": "service",
|
|
214
237
|
"description": "Service (服务层)",
|
|
215
238
|
"body": [
|
|
216
|
-
"import '${relative_core_path}';",
|
|
217
|
-
"",
|
|
218
239
|
"class ${1:Name}Service {",
|
|
219
|
-
"
|
|
220
|
-
" Future<List<dynamic>> fetchList({",
|
|
221
|
-
" int page = 1,",
|
|
222
|
-
" int pageSize = 10,",
|
|
223
|
-
" }) async {",
|
|
224
|
-
" // TODO: 实现网络请求",
|
|
225
|
-
" await Future.delayed(const Duration(seconds: 1));",
|
|
226
|
-
" return [];",
|
|
227
|
-
" }",
|
|
240
|
+
" const ${1:Name}Service();",
|
|
228
241
|
"",
|
|
229
|
-
"
|
|
230
|
-
" Future<dynamic> fetchById(String id) async {",
|
|
231
|
-
" // TODO: 实现网络请求",
|
|
232
|
-
" return null;",
|
|
233
|
-
" }",
|
|
242
|
+
" // TODO: 在这里补充业务方法",
|
|
234
243
|
"}",
|
|
235
244
|
"",
|
|
236
245
|
],
|