├── .flutter-plugins-dependencies
├── .gitattributes
├── .github
└── workflows
│ ├── issue.yml
│ └── pull_request.yml
├── .gitignore
├── .metadata
├── .vscode
└── launch.json
├── LICENSE
├── README.md
├── android
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── finogeeks
│ │ │ │ └── mop_demo
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── doc
└── mop_flutter_demo.gif
├── ios
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ ├── Flutter.podspec
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── Runner
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── FATFlutterViewController.h
│ ├── FATFlutterViewController.m
│ ├── Info.plist
│ └── main.m
├── lib
└── main.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── widget_test.dart
/.flutter-plugins-dependencies:
--------------------------------------------------------------------------------
1 | {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/tao/development/flutter/.pub-cache/hosted/mirrors.tuna.tsinghua.edu.cn%47dart-pub%47/mop-2.43.9/","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/tao/development/flutter/.pub-cache/hosted/mirrors.tuna.tsinghua.edu.cn%47dart-pub%47/flutter_plugin_android_lifecycle-2.0.7/","dependencies":[]},{"name":"mop","path":"/Users/tao/development/flutter/.pub-cache/hosted/mirrors.tuna.tsinghua.edu.cn%47dart-pub%47/mop-2.43.9/","dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"mop","dependencies":["flutter_plugin_android_lifecycle"]}],"date_created":"2024-03-21 09:57:35.541949","version":"2.10.5"}
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.* linguist-language=dart
2 |
--------------------------------------------------------------------------------
/.github/workflows/issue.yml:
--------------------------------------------------------------------------------
1 | name: Notify
2 | on:
3 | issues:
4 | types: [opened]
5 | issue_comment:
6 | types: [created]
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v2
12 | - name: Notify
13 | run: curl --location --request POST 'https://api.finogeeks.club/api/v1/finstore/webhooks/61b331d79b3dad0001f72fa2/postreceive?nonce=jhd2QyrArsc' --header "Content-Type:application/json" --data-raw '{"msg":"仓库 ${{github.repository}} 有新的 issue"}'
14 |
--------------------------------------------------------------------------------
/.github/workflows/pull_request.yml:
--------------------------------------------------------------------------------
1 | name: Notify
2 | on:
3 | pull_request:
4 | branches: [ master ]
5 | jobs:
6 | build:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v2
10 | - name: Notify
11 | run: curl --location --request POST 'https://api.finogeeks.club/api/v1/finstore/webhooks/61b331d79b3dad0001f72fa2/postreceive?nonce=jhd2QyrArsc' --header "Content-Type:application/json" --data-raw '{"msg":"仓库 ${{github.repository}} 有新的 PR ${{ github.event.pull_request._links.html.href }}"}'
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .packages
28 | .pub-cache/
29 | .pub/
30 | /build/
31 |
32 | # Android related
33 | **/android/**/gradle-wrapper.jar
34 | **/android/.gradle
35 | **/android/captures/
36 | **/android/gradlew
37 | **/android/gradlew.bat
38 | **/android/local.properties
39 | **/android/**/GeneratedPluginRegistrant.java
40 |
41 | # iOS/XCode related
42 | **/ios/**/*.mode1v3
43 | **/ios/**/*.mode2v3
44 | **/ios/**/*.moved-aside
45 | **/ios/**/*.pbxuser
46 | **/ios/**/*.perspectivev3
47 | **/ios/**/*sync/
48 | **/ios/**/.sconsign.dblite
49 | **/ios/**/.tags*
50 | **/ios/**/.vagrant/
51 | **/ios/**/DerivedData/
52 | **/ios/**/Icon?
53 | **/ios/**/Pods/
54 | **/ios/**/.symlinks/
55 | **/ios/**/profile
56 | **/ios/**/xcuserdata
57 | **/ios/.generated/
58 | **/ios/Flutter/App.framework
59 | **/ios/Flutter/Flutter.framework
60 | **/ios/Flutter/Generated.xcconfig
61 | **/ios/Flutter/app.flx
62 | **/ios/Flutter/app.zip
63 | **/ios/Flutter/flutter_assets/
64 | **/ios/Flutter/flutter_export_environment.sh
65 | **/ios/ServiceDefinitions.json
66 | **/ios/Runner/GeneratedPluginRegistrant.*
67 |
68 | ios/Podfile.lock
69 |
70 | # Exceptions to above rules.
71 | !**/ios/**/default.mode1v3
72 | !**/ios/**/default.mode2v3
73 | !**/ios/**/default.pbxuser
74 | !**/ios/**/default.perspectivev3
75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
76 | # See https://www.dartlang.org/guides/libraries/private-files
77 |
78 | # Files and directories created by pub
79 | .dart_tool/
80 | .packages
81 | build/
82 | # If you're building an application, you may want to check-in your pubspec.lock
83 | pubspec.lock
84 |
85 | # Directory created by dartdoc
86 | # If you don't generate documentation locally you can remove this line.
87 | doc/api/
88 |
89 | # Avoid committing generated Javascript files:
90 | *.dart.js
91 | *.info.json # Produced by the --dump-info flag.
92 | *.js # When generated by dart2js. Don't specify *.js if your
93 | # project includes source files written in JavaScript.
94 | *.js_
95 | *.js.deps
96 | *.js.map
97 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 1aedbb1835bd6eb44550293d57d4d124f19901f0
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "Flutter",
9 | "request": "launch",
10 | "type": "dart"
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 finogeeks
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.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | FinClip Flutter DEMO
9 |
10 |
11 | 本项目提供在 Flutter 环境中运行小程序的示例 DEMO
12 |
13 |
14 |
15 | 👉 https://www.finclip.com/ 👈
16 |
17 |
18 |
19 |
20 |

21 |

22 |

23 |

24 |
25 |

26 |

27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | [官方网站](https://www.finclip.com/) | [示例小程序](https://www.finclip.com/#/market) | [开发文档](https://www.finclip.com/mop/document/) | [部署指南](https://www.finclip.com/mop/document/introduce/quickStart/cloud-server-deployment-guide.html) | [SDK 集成指南](https://www.finclip.com/mop/document/introduce/quickStart/intergration-guide.html) | [API 列表](https://www.finclip.com/mop/document/develop/api/overview.html) | [组件列表](https://www.finclip.com/mop/document/develop/component/overview.html) | [隐私承诺](https://www.finclip.com/mop/document/operate/safety.html)
37 |
38 |
39 |
40 | -----
41 | ## 🤔 FinClip 是什么?
42 |
43 | 有没有**想过**,开发好的微信小程序能放在自己的 APP 里直接运行,只需要开发一次小程序,就能在不同的应用中打开它,是不是很不可思议?
44 |
45 | 有没有**试过**,在自己的 APP 中引入一个 SDK ,应用中不仅可以打开小程序,还能自定义小程序接口,修改小程序样式,是不是觉得更不可思议?
46 |
47 | 这就是 FinClip ,就是有这么多不可思议!
48 |
49 | ## ⚙️ Flutter 集成
50 |
51 | 在项目 `pubspec.yaml` 文件中添加依赖
52 |
53 | ```yaml
54 | mop: latest.version
55 | ```
56 |
57 | ## 🖥 示例
58 |
59 | ```flutter
60 | import 'package:flutter/material.dart';
61 | import 'dart:async';
62 | import 'dart:io';
63 | import 'package:mop/mop.dart';
64 |
65 | void main() => runApp(MyApp());
66 |
67 | class MyApp extends StatefulWidget {
68 | @override
69 | _MyAppState createState() => _MyAppState();
70 | }
71 |
72 | class _MyAppState extends State {
73 | @override
74 | void initState() {
75 | super.initState();
76 | init();
77 | }
78 |
79 | // Platform messages are asynchronous, so we initialize in an async method.
80 | Future init() async {
81 | if (Platform.isiOS) {
82 | //com.finogeeks.mopExample
83 | final res = await Mop.instance.initialize(
84 | '22LyZEib0gLTQdU3MUauARlLry7JL/2fRpscC9kpGZQA', '1c11d7252c53e0b6',
85 | apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
86 | print(res);
87 | } else if (Platform.isAndroid) {
88 | //com.finogeeks.mopexample
89 | final res = await Mop.instance.initialize(
90 | '22LyZEib0gLTQdU3MUauARjmmp6QmYgjGb3uHueys1oA', '98c49f97a031b555',
91 | apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
92 | print(res);
93 | }
94 | if (!mounted) return;
95 | }
96 |
97 | @override
98 | Widget build(BuildContext context) {
99 | return MaterialApp(
100 | home: Scaffold(
101 | appBar: AppBar(
102 | title: const Text('凡泰极客小程序 Flutter 插件'),
103 | ),
104 | body: Center(
105 | child: Container(
106 | padding: EdgeInsets.only(
107 | top: 20,
108 | ),
109 | child: Column(
110 | children: [
111 | Container(
112 | decoration: BoxDecoration(
113 | borderRadius: BorderRadius.all(Radius.circular(5)),
114 | gradient: LinearGradient(
115 | colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
116 | stops: const [0.0, 1.0],
117 | begin: Alignment.topCenter,
118 | end: Alignment.bottomCenter,
119 | ),
120 | ),
121 | child: FlatButton(
122 | onPressed: () {
123 | Mop.instance.openApplet('5e3c147a188211000141e9b1');
124 | },
125 | child: Text(
126 | '打开示例小程序',
127 | style: TextStyle(color: Colors.white),
128 | ),
129 | ),
130 | ),
131 | SizedBox(height: 30),
132 | Container(
133 | decoration: BoxDecoration(
134 | borderRadius: BorderRadius.all(Radius.circular(5)),
135 | gradient: LinearGradient(
136 | colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
137 | stops: const [0.0, 1.0],
138 | begin: Alignment.topCenter,
139 | end: Alignment.bottomCenter,
140 | ),
141 | ),
142 | child: FlatButton(
143 | onPressed: () {
144 | Mop.instance.openApplet('5e4d123647edd60001055df1',sequence: 1);
145 | },
146 | child: Text(
147 | '打开官方小程序',
148 | style: TextStyle(color: Colors.white),
149 | ),
150 | ),
151 | ),
152 | ],
153 | ),
154 | ),
155 | ),
156 | ),
157 | );
158 | }
159 | }
160 | ```
161 |
162 | ## 📘 目录结构
163 | ```
164 | .
165 | ├── LICENSE
166 | ├── README.md
167 | ├── android 安卓工程目录
168 | │ ├── app
169 | │ │ ├── build.gradle 应用构建配置
170 | │ │ └── src
171 | │ │ ├── debug
172 | │ │ │ └── AndroidManifest.xml 应用清单文件
173 | │ │ ├── main 应用源码主目录
174 | │ │ │ ├── AndroidManifest.xml 应用清单文件
175 | │ │ │ ├── java 应用源码目录
176 | │ │ │ │ ├── com
177 | │ │ │ │ │ └── finogeeks
178 | │ │ │ │ │ └── mop_demo
179 | │ │ │ │ │ └── MainActivity.java
180 | │ │ │ │ └── io
181 | │ │ │ │ └── flutter
182 | │ │ │ │ └── plugins
183 | │ │ │ │ └── GeneratedPluginRegistrant.java
184 | │ │ │ └── res 资源文件目录
185 | │ │ │ ├── drawable darwable资源目录
186 | │ │ │ │ └── launch_background.xml
187 | │ │ │ ├── mipmap-hdpi 图片资源目录
188 | │ │ │ │ └── ic_launcher.png
189 | │ │ │ ├── mipmap-mdpi 图片资源目录
190 | │ │ │ │ └── ic_launcher.png
191 | │ │ │ ├── mipmap-xhdpi 图片资源目录
192 | │ │ │ │ └── ic_launcher.png
193 | │ │ │ ├── mipmap-xxhdpi 图片资源目录
194 | │ │ │ │ └── ic_launcher.png
195 | │ │ │ ├── mipmap-xxxhdpi 图片资源目录
196 | │ │ │ │ └── ic_launcher.png
197 | │ │ │ └── values
198 | │ │ │ └── styles.xml
199 | │ │ └── profile
200 | │ │ └── AndroidManifest.xml
201 | │ ├── build.gradle
202 | │ ├── gradle gradle版本配置目录,一般情况下无需关注
203 | │ │ └── wrapper
204 | │ │ └── gradle-wrapper.properties
205 | │ ├── gradle.properties
206 | │ ├── local.properties
207 | │ └── settings.gradle
208 | ├── build
209 | ├── doc
210 | │ └── mop_flutter_demo.gif
211 | ├── ios iOS工程目录
212 | │ ├── Flutter Flutter-SDK目录,一般无需关注
213 | │ │ ├── AppFrameworkInfo.plist
214 | │ │ ├── Debug.xcconfig
215 | │ │ ├── Flutter.framework
216 | │ │ ├── Flutter.podspec
217 | │ │ ├── Generated.xcconfig
218 | │ │ ├── Release.xcconfig
219 | │ │ └── flutter_export_environment.sh
220 | │ ├── Podfile pod依赖配置文件
221 | │ ├── Runner iOS源码主目录
222 | │ │ ├── AppDelegate.h
223 | │ │ ├── AppDelegate.m
224 | │ │ ├── Assets.xcassets 图片资源
225 | │ │ │ ├── AppIcon.appiconset 图标
226 | │ │ │ └── LaunchImage.imageset 启动图
227 | │ │ ├── Base.lproj
228 | │ │ │ ├── LaunchScreen.storyboard
229 | │ │ │ └── Main.storyboard
230 | │ │ ├── FATFlutterViewController.h Flutter页面控制器子类
231 | │ │ ├── FATFlutterViewController.m Flutter页面控制器子类
232 | │ │ ├── GeneratedPluginRegistrant.h
233 | │ │ ├── GeneratedPluginRegistrant.m
234 | │ │ ├── Info.plist iOS工程配置文件
235 | │ │ └── main.m
236 | │ └── Runner.xcodeproj
237 | ├── lib Flutter源码主目录
238 | │ ├── main.dart 首页
239 | │ └── wx_pay.dart 微信支付源码
240 | ├── pubspec.lock
241 | ├── pubspec.yaml Flutter配置文件
242 | └── test
243 | └── widget_test.dart
244 | ```
245 |
246 | ## 📋 接口文档
247 |
248 | ### 1. 初始化小程序
249 |
250 | 在使用 SDK 提供的 API 之前必须要初始化 SDK ,初始化 SDK 的接口如下
251 |
252 | ```
253 | ///
254 | /// initialize mop miniprogram engine.
255 | /// 初始化小程序
256 | /// [appkey] is required. it can be getted from api.finclip.com
257 | /// [secret] is required. it can be getted from api.finclip.com
258 | /// [apiServer] is optional. the mop server address. default is https://mp.finogeek.com
259 | /// [apiPrefix] is optional. the mop server prefix. default is /api/v1/mop
260 | ///
261 | ///
262 | Future