-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_platform_channel.dart
executable file
·79 lines (68 loc) · 2.38 KB
/
local_platform_channel.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import 'package:flutter/material.dart';
import 'package:worldfunclub/main.dart';
import 'package:worldfunclub/other.dart';
import 'package:worldfunclub/ui/order/order_list_page.dart';
import 'package:worldfunclub/ui/pay_success_page.dart';
import 'package:worldfunclub/utils/log.dart';
import 'package:worldfunclublocal/worldfunclublocal.dart';
class LocalChannel {
static const kWechatCodeResponse = "wechatCodeResponse";
static const kLoginWithWechat = "loginWithWechat";
static const kStartRouteActivity = "startRouteActivity";
static void listener(LocalChannelResponse resp) {
Worldfunclublocal.listener(resp, (call) {
switch (call.method) {
case "payFailed":
return null;
case "paySuccess":
var map = call.arguments;
Log.e(map["pay"]);
App.navigatorKey.currentState.push(MaterialPageRoute(
builder: (builder) =>
PaySuccessPage(map["orderId"].toString(),
map["orderType"].toString(), map["pay"].toString())));
return null;
case "openOrderList":
var map = call.arguments;
String orderType = map["orderType"];
while (App.navigatorKey.currentState.canPop()) {
App.navigatorKey.currentState.pop();
}
App.navigatorKey.currentState.push(MaterialPageRoute(
builder: (builder) =>
OrderListPage(
goodsType: orderType == "1"
? GoodsType.self
: GoodsType.live,
state: orderType == "1" ? 1 : 0,
)));
return null;
case "openHome":
while (App.navigatorKey.currentState.canPop()) {
App.navigatorKey.currentState.pop();
}
return null;
default:
return null;
}
});
}
static void loginWithWechat() {
Worldfunclublocal.loginWithWechat();
}
static void startActivityWithUrl(String url) {
Worldfunclublocal.startActivityWithUrl(url);
}
static void callPhone(String phone) {
Worldfunclublocal.callPhone(phone);
}
static void wechatPay(dynamic map) {
Worldfunclublocal.wechatPay(map);
}
static void startScan() {
Worldfunclublocal.startScan();
}
static void openLocation(double lat, double lon, String name) {
Worldfunclublocal.openLocation(lat, lon, name);
}
}