82c8633c
biao
音频添加 页面优化
|
1
|
import 'package:audioplayers/audioplayers.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
2
|
import 'package:flutter/material.dart';
|
cde7505e
吴启风
feat:应用内升级
|
3
4
|
import 'package:flutter_app_update/azhon_app_update.dart';
import 'package:flutter_app_update/update_model.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
5
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
cde7505e
吴启风
feat:应用内升级
|
6
|
import 'package:url_launcher/url_launcher.dart';
|
28f20da9
吴启风
feat:针对apple审核对支付...
|
7
|
import 'package:wow_english/common/core/app_config_helper.dart';
|
a04e399e
biao
小鹅购买
|
8
|
import 'package:wow_english/common/core/app_consts.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
9
|
import 'package:wow_english/common/extension/string_extension.dart';
|
2c079546
吴启风
feat:应用内更新接口替换
|
10
|
import 'package:wow_english/models/app_version_entity.dart';
|
2187c85f
吴启风
feat:课程结构调整
|
11
12
|
import 'package:wow_english/pages/home/state.dart';
import 'package:wow_english/pages/home/widgets/BaseHomeHeaderWidget.dart';
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
13
|
import 'package:wow_english/pages/shop/exchane/bloc/exchange_lesson_bloc.dart';
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
14
|
import 'package:wow_english/pages/user/bloc/user_bloc.dart';
|
b1869cf8
biao
背景音乐添加
|
15
|
import 'package:wow_english/utils/audioplayer_util.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
16
|
|
278208b8
吴启风
feat:1、用户访问权限调整;2...
|
17
18
|
import '../../common/core/user_util.dart';
import '../../common/dialogs/show_dialog.dart';
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
19
20
21
22
23
|
import 'bloc.dart';
import 'event.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/route/route.dart';
|
2187c85f
吴启风
feat:课程结构调整
|
24
25
|
class HomePage extends StatelessWidget {
const HomePage({super.key});
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
26
27
28
29
|
@override
Widget build(BuildContext context) {
return BlocProvider(
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
30
31
32
|
create: (BuildContext context) => HomeBloc()
..add(InitEvent())
..add(ExchangeSuccessEvent()),
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
33
34
35
36
37
38
39
40
|
child: Builder(builder: (context) => _HomePageView()),
);
}
}
class _HomePageView extends StatelessWidget {
@override
Widget build(BuildContext context) {
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
41
|
return MultiBlocListener(listeners: [
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
42
|
BlocListener<UserBloc, UserState>(listener: (context, state) {}),
|
f74aeedc
吴启风
feat:首页类名调整
|
43
|
BlocListener<HomeBloc, HomeState>(
|
cde7505e
吴启风
feat:应用内升级
|
44
|
listener: (context, state) {
|
cde7505e
吴启风
feat:应用内升级
|
45
|
if (state is UpdateDialogState) {
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
46
47
|
_showUpdateDialog(
context, state.forceUpdate, state.appVersionEntity);
|
cde7505e
吴启风
feat:应用内升级
|
48
49
|
}
},
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
50
51
|
),
], child: _homeView());
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
52
53
|
}
|
cde7505e
吴启风
feat:应用内升级
|
54
|
Widget _homeView() =>
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
55
56
57
58
59
60
61
62
63
|
BlocBuilder<HomeBloc, HomeState>(builder: (context, state) {
final bloc = BlocProvider.of<HomeBloc>(context);
return Scaffold(
body: Container(
color: Colors.white,
child: Column(
children: [
BaseHomeHeaderWidget(
callBack: (value) => {
|
b1869cf8
biao
背景音乐添加
|
64
65
|
AudioPlayerUtil.getInstance()
.playAudio(AudioPlayerUtilType.touch),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
66
67
68
69
70
71
72
73
74
75
76
|
bloc.exchangeResult = value['exchange'],
bloc.add(ExchangeSuccessEvent())
}),
Expanded(
child: Center(
child: Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
_checkPermission(() {
|
b1869cf8
biao
背景音乐添加
|
77
78
|
AudioPlayerUtil.getInstance()
.playAudio(AudioPlayerUtilType.classTime);
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
79
80
81
82
83
84
85
86
87
88
89
|
Future.delayed(const Duration(seconds: 1), () {
pushNamed(AppRouteName.courseUnit)
.then((value) => {
if (value != null)
{
bloc.exchangeResult =
value['exchange'],
bloc.add(ExchangeSuccessEvent())
}
});
});
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
}, 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),
],
),
),
),
|
b1869cf8
biao
背景音乐添加
|
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
|
Offstage(
offstage: AppConfigHelper.shouldHidePay() ||
!UserUtil.isLogined(),
child: Expanded(
child: BlocBuilder<UserBloc, UserState>(
builder: (context, userState) {
return GestureDetector(
onTap: () {
_checkPermission(() {
AudioPlayerUtil.getInstance().pause();
Navigator.of(context).pushNamed(
AppRouteName.webView,
arguments: {
'urlStr': AppConsts.xiaoeShopUrl,
'webViewTitle': 'Wow精选'
}).then((value) => {
AudioPlayerUtil.getInstance()
.playAudio(
AudioPlayerUtilType.touch),
});
}, bloc);
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('xe_shop'.assetPng,
width: 140.5.w, height: 172.h),
44.verticalSpace
],
));
}),
),
|
a04e399e
biao
小鹅购买
|
146
147
148
149
150
151
152
|
),
Expanded(
child: BlocBuilder<UserBloc, UserState>(
builder: (context, userState) {
return GestureDetector(
onTap: () {
_checkPermission(() {
|
b1869cf8
biao
背景音乐添加
|
153
154
155
156
157
158
159
160
|
AudioPlayerUtil.getInstance().playAudio(
AudioPlayerUtilType.gameTime);
pushNamed(AppRouteName.games)
.then((value) => {
AudioPlayerUtil.getInstance()
.playAudio(AudioPlayerUtilType
.touch),
});
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
161
|
}, bloc);
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
162
163
164
165
166
167
168
169
170
|
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Stack(
alignment: AlignmentDirectional.center,
children: [
Image.asset(
'bg_frame_module'.assetPng,
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
171
172
173
174
175
176
|
width: 162.5.w,
height: 203.5.h),
Image.asset(
'pic_module_game'.assetPng,
width: 140.5.w,
height: 172.h)
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
177
178
|
]),
10.verticalSpace,
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
179
|
Image.asset('label_module_game'.assetPng,
|
795fb23f
吴启风
feat:支付成功刷新用户数据
|
180
181
|
width: 124.w, height: 34.h),
],
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
182
183
|
));
}),
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
184
|
),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
185
186
187
188
189
190
191
192
193
|
],
),
),
)
],
),
),
);
});
|
cde7505e
吴启风
feat:应用内升级
|
194
|
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
195
|
_checkPermission(VoidCallback onAllowed, HomeBloc bloc) {
|
578775ca
吴启风
feat:课程学习增加vip权限控制
|
196
197
198
199
200
201
202
|
if (UserUtil.isLogined()) {
if (AppConfigHelper.shouldHidePay()) {
onAllowed();
} else {
if (UserUtil.hasPermission()) {
onAllowed();
} else {
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
203
204
205
206
207
208
|
showTwoActionDialog('提示', '忽略', '去续费', '您的课程已到期,请快快续费继续学习吧!',
leftTap: () {
popPage();
}, rightTap: () {
popPage();
pushNamed(AppRouteName.shop).then((value) {
|
b1869cf8
biao
背景音乐添加
|
209
210
|
AudioPlayerUtil.getInstance()
.playAudio(AudioPlayerUtilType.touch);
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
211
212
213
214
215
216
|
if (value != null) {
bloc.exchangeResult = value['exchange'];
bloc.add(ExchangeSuccessEvent());
}
});
});
|
578775ca
吴启风
feat:课程学习增加vip权限控制
|
217
218
219
220
221
222
223
224
|
}
}
} else {
//如果没登录先登录
pushNamed(AppRouteName.login);
}
}
|
cde7505e
吴启风
feat:应用内升级
|
225
226
227
|
///Flutter侧处理升级对话框
///[forcedUpgrade] 是否强制升级
_showUpdateDialog(BuildContext context, bool forcedUpgrade,
|
2c079546
吴启风
feat:应用内更新接口替换
|
228
|
AppVersionEntity appVersionEntity) {
|
cde7505e
吴启风
feat:应用内升级
|
229
230
231
232
233
234
235
236
237
|
showDialog(
context: context,
// 当我们点击除开对话框内容以外的区域是否关闭对话需用用到barrierDismissible参数 . 这个参数默认值是true ,但不能为null .
barrierDismissible: !forcedUpgrade,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () => Future.value(!forcedUpgrade),
child: AlertDialog(
title: const Text('发现新版本'),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
238
|
content: Text(appVersionEntity.remark ?? '修复了一些已知问题'),
|
cde7505e
吴启风
feat:应用内升级
|
239
240
241
|
actions: <Widget>[
TextButton(
child: Text(forcedUpgrade ? '退出' : '取消'),
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
242
243
244
245
246
|
onPressed: () => {
if (forcedUpgrade)
{AppConfigHelper.exitApp()}
else
{Navigator.of(context).pop()}
|
cde7505e
吴启风
feat:应用内升级
|
247
248
249
250
251
|
},
),
TextButton(
child: const Text('升级'),
onPressed: () async {
|
911794fd
吴启风
feat:审核控制增加ios平台条件判断
|
252
|
if (AppConfigHelper.isIosPlatform()) {
|
cde7505e
吴启风
feat:应用内升级
|
253
254
255
|
_launchAppStore("6450870731");
return;
}
|
2c079546
吴启风
feat:应用内更新接口替换
|
256
|
final String? apkUrl = appVersionEntity.packageUrl;
|
cde7505e
吴启风
feat:应用内升级
|
257
258
259
260
261
262
263
264
265
|
if (apkUrl == null || apkUrl.isEmpty) {
return;
}
UpdateModel model = UpdateModel(
apkUrl,
"wowenglish.apk",
"ic_launcher",
'',
);
|
e6a08b82
biao
修复兑换之后回到首页不刷新问题;修...
|
266
267
|
AzhonAppUpdate.update(model)
.then((value) => debugPrint('$value'));
|
cde7505e
吴启风
feat:应用内升级
|
268
269
270
271
272
273
|
if (!forcedUpgrade) {
Navigator.of(context).pop();
}
},
),
],
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
274
275
|
),
);
|
cde7505e
吴启风
feat:应用内升级
|
276
277
278
279
280
281
282
283
284
285
286
287
|
},
);
}
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';
}
}
|
6d61919a
吴启风
feat:增加过渡页&集成串联游戏
|
288
|
}
|