4b858f67
吴启风
feat:webview库替换
|
1
2
|
import 'dart:io';
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
3
|
import 'package:flutter/cupertino.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
4
|
import 'package:flutter/material.dart';
|
4b858f67
吴启风
feat:webview库替换
|
5
|
import 'package:flutter/services.dart';
|
cde7505e
吴启风
feat:应用内升级
|
6
7
|
import 'package:flutter_app_update/azhon_app_update.dart';
import 'package:flutter_app_update/update_model.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
8
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
4b858f67
吴启风
feat:webview库替换
|
9
|
import 'package:limiting_direction_csx/limiting_direction_csx.dart';
|
cde7505e
吴启风
feat:应用内升级
|
10
|
import 'package:url_launcher/url_launcher.dart';
|
28f20da9
吴启风
feat:针对apple审核对支付...
|
11
|
import 'package:wow_english/common/core/app_config_helper.dart';
|
a04e399e
biao
小鹅购买
|
12
|
import 'package:wow_english/common/core/app_consts.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
13
|
import 'package:wow_english/common/extension/string_extension.dart';
|
2c079546
吴启风
feat:应用内更新接口替换
|
14
|
import 'package:wow_english/models/app_version_entity.dart';
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
15
16
|
import 'package:wow_english/models/popup_entity.dart';
import 'package:wow_english/pages/home/PopupType.dart';
|
2187c85f
吴启风
feat:课程结构调整
|
17
18
|
import 'package:wow_english/pages/home/state.dart';
import 'package:wow_english/pages/home/widgets/BaseHomeHeaderWidget.dart';
|
79de0824
吴启风
feat:小鹅通入口图片增加摇摆动画
|
19
|
import 'package:wow_english/pages/home/widgets/ShakeImage.dart';
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
20
|
import 'package:wow_english/pages/user/bloc/user_bloc.dart';
|
025d8543
biao
首页gametime播放修改
|
21
|
import 'package:wow_english/utils/audio_player_util.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
22
|
|
278208b8
吴启风
feat:1、用户访问权限调整;2...
|
23
24
|
import '../../common/core/user_util.dart';
import '../../common/dialogs/show_dialog.dart';
|
7be2176f
吴启风
feat:课程学习和游戏专区点击防抖
|
25
|
import '../../common/utils/click_with_music_controller.dart';
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
26
|
import '../../common/widgets/ow_image_widget.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
27
28
29
30
31
|
import 'bloc.dart';
import 'event.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/route/route.dart';
|
2187c85f
吴启风
feat:课程结构调整
|
32
33
|
class HomePage extends StatelessWidget {
const HomePage({super.key});
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
34
35
36
37
|
@override
Widget build(BuildContext context) {
return BlocProvider(
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
38
39
40
|
create: (BuildContext context) => HomeBloc()
..add(InitEvent())
..add(ExchangeSuccessEvent()),
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
41
42
43
44
45
46
47
48
|
child: Builder(builder: (context) => _HomePageView()),
);
}
}
class _HomePageView extends StatelessWidget {
@override
Widget build(BuildContext context) {
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
49
|
return MultiBlocListener(listeners: [
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
50
|
BlocListener<UserBloc, UserState>(listener: (context, state) {}),
|
f74aeedc
吴启风
feat:首页类名调整
|
51
|
BlocListener<HomeBloc, HomeState>(
|
cde7505e
吴启风
feat:应用内升级
|
52
|
listener: (context, state) {
|
cde7505e
吴启风
feat:应用内升级
|
53
|
if (state is UpdateDialogState) {
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
54
55
|
_showUpdateDialog(
context, state.forceUpdate, state.appVersionEntity);
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
56
57
|
} else if (state is PopupDialogState) {
_showPopupDialog(context, state.popupEntity);
|
cde7505e
吴启风
feat:应用内升级
|
58
59
|
}
},
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
60
61
|
),
], child: _homeView());
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
62
63
|
}
|
cde7505e
吴启风
feat:应用内升级
|
64
|
Widget _homeView() =>
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
65
66
|
BlocBuilder<HomeBloc, HomeState>(builder: (context, state) {
final bloc = BlocProvider.of<HomeBloc>(context);
|
7be2176f
吴启风
feat:课程学习和游戏专区点击防抖
|
67
|
final clickController = ClickWithMusicController.instance;
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
68
69
70
71
72
73
|
return Scaffold(
body: Container(
color: Colors.white,
child: Column(
children: [
BaseHomeHeaderWidget(
|
2d1ead53
吴启风
feat:背景音播放优化
|
74
75
|
callBack: (value) async => {
await AudioPlayerUtil.getInstance()
|
b1869cf8
biao
背景音乐添加
|
76
|
.playAudio(AudioPlayerUtilType.touch),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
77
78
79
80
81
82
83
84
85
86
|
bloc.exchangeResult = value['exchange'],
bloc.add(ExchangeSuccessEvent())
}),
Expanded(
child: Center(
child: Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
|
b2af9c1c
biao
播放修改
|
87
|
_checkPermission(() async {
|
a0bbff8c
吴启风
feat:代码优化-背景音播放使用...
|
88
|
await clickController.playMusicAndPerformAction(
|
7be2176f
吴启风
feat:课程学习和游戏专区点击防抖
|
89
90
91
92
|
context, AudioPlayerUtilType.classTime,
() async {
pushNamed(AppRouteName.courseUnit)
.then((value) => {
|
9e14f47a
吴启风
feat:解决开场音乐前点击(带音...
|
93
94
95
|
AudioPlayerUtil.getInstance()
.playAudio(
AudioPlayerUtilType.touch),
|
7be2176f
吴启风
feat:课程学习和游戏专区点击防抖
|
96
97
98
99
100
101
102
103
|
if (value != null)
{
bloc.exchangeResult =
value['exchange'],
bloc.add(ExchangeSuccessEvent())
}
});
});
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
}, bloc);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Stack(
alignment: AlignmentDirectional.center,
children: [
Image.asset('bg_frame_module'.assetPng,
width: 162.5.w, height: 203.5.h),
Center(
child: Image.asset(
'pic_module_study'.assetPng,
width: 140.5.w,
height: 172.h),
)
]),
10.verticalSpace,
Image.asset('label_module_study'.assetPng,
width: 124.w, height: 34.h),
],
),
),
),
|
4b0aa690
biao
首页小鹅通入口优化
|
128
129
130
131
|
BlocBuilder<UserBloc, UserState>(
builder: (context, userState) {
return GestureDetector(
onTap: () {
|
7be2176f
吴启风
feat:课程学习和游戏专区点击防抖
|
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
|
_checkPermission(() async {
await AudioPlayerUtil.getInstance().pause();
if (Platform.isIOS) {
await LimitingDirectionCsx
.setScreenDirection(
DeviceDirectionMask.Portrait);
} else {
await SystemChrome
.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown
]);
}
Navigator.of(context).pushNamed(
AppRouteName.webView,
arguments: {
'urlStr': AppConsts.xiaoeShopUrl,
'webViewTitle': 'Wow精选'
}).then((value) async => {
if (Platform.isIOS)
{
await LimitingDirectionCsx
.setScreenDirection(
DeviceDirectionMask
.Landscape),
}
else
{
await SystemChrome
.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight
]),
|
4b858f67
吴启风
feat:webview库替换
|
165
|
},
|
7be2176f
吴启风
feat:课程学习和游戏专区点击防抖
|
166
167
168
169
170
|
await AudioPlayerUtil.getInstance()
.playAudio(
AudioPlayerUtilType.touch),
});
}, bloc);
|
4b0aa690
biao
首页小鹅通入口优化
|
171
172
173
174
|
},
child: Offstage(
offstage: AppConfigHelper.shouldHidePay() ||
!UserUtil.isLogined(),
|
79de0824
吴启风
feat:小鹅通入口图片增加摇摆动画
|
175
|
child: const ShakeImage(),
|
4b0aa690
biao
首页小鹅通入口优化
|
176
177
|
));
}),
|
a04e399e
biao
小鹅购买
|
178
179
180
181
182
|
Expanded(
child: BlocBuilder<UserBloc, UserState>(
builder: (context, userState) {
return GestureDetector(
onTap: () {
|
b2af9c1c
biao
播放修改
|
183
|
_checkPermission(() async {
|
9e14f47a
吴启风
feat:解决开场音乐前点击(带音...
|
184
185
186
187
|
await clickController
.playMusicAndPerformAction(context,
AudioPlayerUtilType.gameTime,
() async {
|
7be2176f
吴启风
feat:课程学习和游戏专区点击防抖
|
188
189
190
191
192
193
194
195
|
pushNamed(AppRouteName.games)
.then((value) => {
AudioPlayerUtil.getInstance()
.playAudio(
AudioPlayerUtilType
.touch),
});
});
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
196
|
}, bloc);
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
197
198
199
200
201
202
203
204
205
|
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Stack(
alignment: AlignmentDirectional.center,
children: [
Image.asset(
'bg_frame_module'.assetPng,
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
206
207
208
209
210
211
|
width: 162.5.w,
height: 203.5.h),
Image.asset(
'pic_module_game'.assetPng,
width: 140.5.w,
height: 172.h)
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
212
213
|
]),
10.verticalSpace,
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
214
|
Image.asset('label_module_game'.assetPng,
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
215
216
|
width: 124.w, height: 34.h),
],
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
217
218
|
));
}),
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
219
|
),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
220
221
222
223
224
225
226
227
228
|
],
),
),
)
],
),
),
);
});
|
cde7505e
吴启风
feat:应用内升级
|
229
|
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
230
|
_checkPermission(VoidCallback onAllowed, HomeBloc bloc) {
|
578775ca
吴启风
feat:课程学习增加vip权限控制
|
231
232
233
234
235
236
237
|
if (UserUtil.isLogined()) {
if (AppConfigHelper.shouldHidePay()) {
onAllowed();
} else {
if (UserUtil.hasPermission()) {
onAllowed();
} else {
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
238
239
240
241
242
243
|
showTwoActionDialog('提示', '忽略', '去续费', '您的课程已到期,请快快续费继续学习吧!',
leftTap: () {
popPage();
}, rightTap: () {
popPage();
pushNamed(AppRouteName.shop).then((value) {
|
b1869cf8
biao
背景音乐添加
|
244
245
|
AudioPlayerUtil.getInstance()
.playAudio(AudioPlayerUtilType.touch);
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
246
247
248
249
250
251
|
if (value != null) {
bloc.exchangeResult = value['exchange'];
bloc.add(ExchangeSuccessEvent());
}
});
});
|
578775ca
吴启风
feat:课程学习增加vip权限控制
|
252
253
254
255
256
257
258
259
|
}
}
} else {
//如果没登录先登录
pushNamed(AppRouteName.login);
}
}
|
cde7505e
吴启风
feat:应用内升级
|
260
261
262
|
///Flutter侧处理升级对话框
///[forcedUpgrade] 是否强制升级
_showUpdateDialog(BuildContext context, bool forcedUpgrade,
|
2c079546
吴启风
feat:应用内更新接口替换
|
263
|
AppVersionEntity appVersionEntity) {
|
cde7505e
吴启风
feat:应用内升级
|
264
265
266
267
268
269
270
271
272
|
showDialog(
context: context,
// 当我们点击除开对话框内容以外的区域是否关闭对话需用用到barrierDismissible参数 . 这个参数默认值是true ,但不能为null .
barrierDismissible: !forcedUpgrade,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () => Future.value(!forcedUpgrade),
child: AlertDialog(
title: const Text('发现新版本'),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
273
|
content: Text(appVersionEntity.remark ?? '修复了一些已知问题'),
|
cde7505e
吴启风
feat:应用内升级
|
274
275
276
|
actions: <Widget>[
TextButton(
child: Text(forcedUpgrade ? '退出' : '取消'),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
277
278
279
280
281
|
onPressed: () => {
if (forcedUpgrade)
{AppConfigHelper.exitApp()}
else
{Navigator.of(context).pop()}
|
cde7505e
吴启风
feat:应用内升级
|
282
283
284
285
286
|
},
),
TextButton(
child: const Text('升级'),
onPressed: () async {
|
911794fd
吴启风
feat:审核控制增加ios平台条件判断
|
287
|
if (AppConfigHelper.isIosPlatform()) {
|
cde7505e
吴启风
feat:应用内升级
|
288
289
290
|
_launchAppStore("6450870731");
return;
}
|
2c079546
吴启风
feat:应用内更新接口替换
|
291
|
final String? apkUrl = appVersionEntity.packageUrl;
|
cde7505e
吴启风
feat:应用内升级
|
292
293
294
295
296
297
298
299
300
|
if (apkUrl == null || apkUrl.isEmpty) {
return;
}
UpdateModel model = UpdateModel(
apkUrl,
"wowenglish.apk",
"ic_launcher",
'',
);
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
301
302
|
AzhonAppUpdate.update(model)
.then((value) => debugPrint('$value'));
|
cde7505e
吴启风
feat:应用内升级
|
303
304
305
306
307
308
|
if (!forcedUpgrade) {
Navigator.of(context).pop();
}
},
),
],
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
309
310
|
),
);
|
cde7505e
吴启风
feat:应用内升级
|
311
312
313
314
315
316
317
318
319
320
321
322
|
},
);
}
void _launchAppStore(String appId) async {
final String url = 'https://apps.apple.com/cn/app/wow-english/id$appId';
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
throw 'Could not launch $url';
}
}
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
323
324
325
|
///popup对话框
void _showPopupDialog(BuildContext context, PopupEntity popupEntity) {
|
0963e27a
吴启风
feat:图片字段修正
|
326
|
if (popupEntity.imageUrl.isEmpty) {
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
return;
}
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Dialog(
backgroundColor: Colors.transparent,
child: Stack(
alignment: Alignment.topRight,
children: [
// 图片内容区域
ClipRRect(
borderRadius: BorderRadius.circular(16), // 可选:圆角
child: GestureDetector(
onTap: () {
if (popupEntity.actionType == PopupType.h5.name &&
popupEntity.actionValue.isNotEmpty) {
Navigator.of(context).pop();
Navigator.of(context).pushNamed(AppRouteName.webView,
arguments: {'urlStr': popupEntity.actionValue});
}
},
child: OwImageWidget(
height: MediaQuery.of(context).size.height * 0.8,
|
0963e27a
吴启风
feat:图片字段修正
|
352
|
name: popupEntity.imageUrl,
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
353
354
355
356
357
358
359
|
fit: BoxFit.fitHeight),
),
),
Positioned(
top: 0,
right: 0,
child: IconButton(
|
0963e27a
吴启风
feat:图片字段修正
|
360
361
362
363
364
365
|
icon: const Icon(
Icons.close,
color: Colors.white,
opticalSize: 2,
shadows: [Shadow(color: Colors.black, blurRadius: 24)],
),
|
99b94d6c
吴启风
feat:首页增加信息弹窗
|
366
367
368
369
370
371
372
373
374
375
376
377
|
onPressed: () {
Navigator.of(context).pop();
},
),
),
],
// 图片宽度和高度是屏幕高度的80%,右上角有一个关闭按钮,点击关闭按钮关闭对话框,图片水平居中,高度在按钮垂直方向下方
),
);
},
);
}
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
378
|
}
|