提交 8e878a79 authored 作者: JarvanMo's avatar JarvanMo

optimize API

上级 a2d88e8b
# 4.0.0-pre.2
* `Fluwx`接口优化。合并了一些函数以优化使用体验。
# 4.0.0-pre.2 # 4.0.0-pre.2
* No_pay现已合并入Fluwx * No_pay现已合并入Fluwx
* 将一些设置移到pubspec.yaml,具体可以参看`example/pubspec.yaml` * 将一些设置移到pubspec.yaml,具体可以参看`example/pubspec.yaml`
......
...@@ -205,7 +205,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -205,7 +205,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: OutlinedButton( child: OutlinedButton(
onPressed: () { onPressed: () {
fluwx.open(WeChatApp()); fluwx.open(target: WeChatApp());
}, },
child: const Text('Open WeChat App'), child: const Text('Open WeChat App'),
), ),
......
...@@ -46,7 +46,7 @@ class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> { ...@@ -46,7 +46,7 @@ class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> {
children: <Widget>[ children: <Widget>[
OutlinedButton( OutlinedButton(
onPressed: () { onPressed: () {
fluwx.launchMiniProgram(username: 'gh_d43f693ca31f'); fluwx.open(target: MiniProgram(username: 'gh_d43f693ca31f'));
}, },
child: const Text('Launch MiniProgrom'), child: const Text('Launch MiniProgrom'),
), ),
......
...@@ -56,6 +56,7 @@ class _PayPageState extends State<PayPage> { ...@@ -56,6 +56,7 @@ class _PayPageState extends State<PayPage> {
debugPrint(result['timestamp']); debugPrint(result['timestamp']);
fluwx fluwx
.pay( .pay(
which: Payment(
appId: result['appid'].toString(), appId: result['appid'].toString(),
partnerId: result['partnerid'].toString(), partnerId: result['partnerid'].toString(),
prepayId: result['prepayid'].toString(), prepayId: result['prepayid'].toString(),
...@@ -63,7 +64,7 @@ class _PayPageState extends State<PayPage> { ...@@ -63,7 +64,7 @@ class _PayPageState extends State<PayPage> {
nonceStr: result['noncestr'].toString(), nonceStr: result['noncestr'].toString(),
timestamp: result['timestamp'], timestamp: result['timestamp'],
sign: result['sign'].toString(), sign: result['sign'].toString(),
) ))
.then((data) { .then((data) {
print('---》$data'); print('---》$data');
}); });
......
...@@ -39,10 +39,11 @@ class _SendAuthPageState extends State<SendAuthPage> { ...@@ -39,10 +39,11 @@ class _SendAuthPageState extends State<SendAuthPage> {
OutlinedButton( OutlinedButton(
onPressed: () { onPressed: () {
fluwx fluwx
.sendAuth( .authBy(
which: NormalAuth(
scope: 'snsapi_userinfo', scope: 'snsapi_userinfo',
state: 'wechat_sdk_demo_test', state: 'wechat_sdk_demo_test',
) ))
.then((data) {}); .then((data) {});
}, },
child: const Text('send auth'), child: const Text('send auth'),
......
...@@ -123,7 +123,8 @@ class _SignAutoDeductPageState extends State<SignAutoDeductPage> { ...@@ -123,7 +123,8 @@ class _SignAutoDeductPageState extends State<SignAutoDeductPage> {
} }
void _signAutoDeduct() { void _signAutoDeduct() {
fluwx.autoDeDuct( fluwx.autoDeduct(
data: AutoDeduct.detail(
appId: appId.text, appId: appId.text,
mchId: mchId.text, mchId: mchId.text,
planId: planId.text, planId: planId.text,
...@@ -135,6 +136,6 @@ class _SignAutoDeductPageState extends State<SignAutoDeductPage> { ...@@ -135,6 +136,6 @@ class _SignAutoDeductPageState extends State<SignAutoDeductPage> {
sign: sign.text, sign: sign.text,
timestamp: timestamp.text, timestamp: timestamp.text,
returnApp: '3', returnApp: '3',
); ));
} }
} }
...@@ -81,11 +81,12 @@ class _SubscribeMessagePageState extends State<SubscribeMessagePage> { ...@@ -81,11 +81,12 @@ class _SubscribeMessagePageState extends State<SubscribeMessagePage> {
} }
void _requestSubMsg() { void _requestSubMsg() {
fluwx.subscribeMsg( fluwx.open(
target: SubscribeMessage(
appId: appId.text, appId: appId.text,
scene: int.tryParse(scene.text) ?? 1, scene: int.tryParse(scene.text) ?? 1,
templateId: templateId.text, templateId: templateId.text,
reserved: reserved.text, reserved: reserved.text,
); ));
} }
} }
name: fluwx name: fluwx
description: The capability of implementing WeChat SDKs in Flutter. With Fluwx, developers can use WeChatSDK easily, such as sharing, payment, lanuch mini program and etc. description: The capability of implementing WeChat SDKs in Flutter. With Fluwx, developers can use WeChatSDK easily, such as sharing, payment, lanuch mini program and etc.
version: 4.0.0-pre.2 version: 4.0.0-pre.3
homepage: https://github.com/OpenFlutter/fluwx homepage: https://github.com/OpenFlutter/fluwx
environment: environment:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论