first_page.dart
12 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
import 'dart:io';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bugly/flutter_bugly.dart';
import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_easyrefresh/material_header.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluwx/fluwx.dart';
import 'package:one_key/app.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:intl/date_symbol_data_local.dart';
import '../../net/dio_util.dart';
import '../../net/http_url.dart';
class FirstPage extends StatefulWidget {
FirstPage({Key key}) : super(key: key);
@override
_FirstPageState createState() => _FirstPageState();
}
class _FirstPageState extends State<FirstPage> {
@override
void initState() {
// TODO: implement initState
super.initState();
// Utils.changeStatusColor(color: MyColours.color_199095);
}
_ontherInit() async {
initDio();
await _initFluwx();
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
// 设置EasyRefresh的默认样式
EasyRefresh.defaultHeader = MaterialHeader();
EasyRefresh.defaultFooter = BallPulseFooter();
App.sp.setBool("isFirst", false);
//进入应用
NavigatorUtil.goLoginPage(context);
FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
}
//初始化微信SDK
_initFluwx() async {
await registerWxApi(
// appId: "wx85aa3cdd0f791e65",
appId: "wx4d105e36a36a6139",
doOnAndroid: true,
doOnIOS: true,
universalLink: "https://xt04.colorcun.com/link/OneKey/");
var result = await isWeChatInstalled;
if (result != null && result) {
App.isInstallWx = true;
} else {
App.isInstallWx = false;
}
LogUtil.v("is installed $result");
}
//初始化dio
initDio() {
DioUtil.openDebug();
BaseOptions options = DioUtil.getDefOptions();
options.baseUrl = HttpUrl.server_address;
HttpConfig config = new HttpConfig(
options: options, status: "ret", code: "ret", msg: "msg", data: "data");
DioUtil().setConfig(config);
_initAmap();
}
_initAmap() async {
await AmapLocation.instance.updatePrivacyShow(true);
await AmapLocation.instance.updatePrivacyAgree(true);
await AmapService.instance.init(
iosKey: '24fe3a700e69114a4328d4e46823dcda',
androidKey: '13464ddadd6a5d825e79f90e10ba72d2');
await AmapLocation.instance.init(
iosKey: '24fe3a700e69114a4328d4e46823dcda',
);
}
@override
Widget build(BuildContext context) {
// ScreenUtil.init(context, width: 750, height: 1334);
return Scaffold(
body: Container(
color: MyColours.color_199095,
height: double.infinity,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(80)),
child: Center(
child: Container(
height: ScreenUtil().setWidth(690),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
),
child: Column(
children: [
VEmptyView(40),
Text(
'温馨提示',
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
VEmptyView(40),
MyDivider(double.infinity, ScreenUtil().setWidth(1)),
Expanded(
child: SingleChildScrollView(
child: Column(children: [
VEmptyView(50),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'亲爱的用户,感谢您信任并使用周到安排商家!',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
VEmptyView(16),
Wrap(
children: [
Text(
'我们制定了',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(
context, '《隐私政策》', "zc",
need: true);
},
child: Text(
'《隐私政策》',
style: TextStyle(
color: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
),
Text(
'和',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
InkWell(
onTap: () {
NavigatorUtil.goWebPage(
context, '软件服务协议', "xy",
need: true);
},
child: Text(
'《软件服务协议》',
style: TextStyle(
color: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
),
Text(
'请您点击同意之前仔细阅读并充分理解相关条款,其中的重点条款已为您标注,方便您了解自己的权利。',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
],
),
VEmptyView(16),
Text(
'我们将通过《隐私政策》向您说明:\n我们在您使用我们的产品与/或服务时如何收集、使用、保存、共享和转让这些信息,以及我们为您提供的访问、更新、控制和保护这些信息的方式。',
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: 1,
leading: 0.3),
),
],
),
)
]),
)),
VEmptyView(40),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
RoundButton(
width: ScreenUtil().setWidth(100 * 2),
height: ScreenUtil().setWidth(70),
radius: ScreenUtil().setWidth(10),
text: '拒绝',
fontSize: 28,
isBold: false,
textColor: MyColours.color_199095,
gradientStart: MyColours.color_efefef,
gradientEnd: MyColours.color_efefef,
onPressed: () {
//修改之前有内容,则弹框
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "您需要同意《周到安排商家隐私政策》,才能继续使用我们的服务哦。",
lTitle: "暂不",
rTitle: "去同意", lCallback: () {
print("取消");
//退出应用
exit(0);
}, rCallback: () {
print("确定");
});
}),
RoundButton(
width: ScreenUtil().setWidth(100 * 2),
height: ScreenUtil().setWidth(70),
radius: ScreenUtil().setWidth(10),
text: '同意',
fontSize: 28,
isBold: false,
textColor: MyColours.color_ffffff,
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
onPressed: () {
_ontherInit();
// App.sp.setBool("isFirst", false);
// //进入应用
// NavigatorUtil.goLoginPage(context);
}),
],
),
VEmptyView(40),
],
),
))),
);
}
}