dbca8811
吴启风
fix: 修复视频兼容性并增加渲染...
|
1
|
import 'package:flutter/foundation.dart';
|
3840b7fe
liangchengyou
feat:更新设置页面
|
2
|
import 'package:flutter/material.dart';
|
c5ed9934
xiaoyu
为清除缓存添加提示
|
3
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
3840b7fe
liangchengyou
feat:更新设置页面
|
4
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
5
|
import 'package:package_info_plus/package_info_plus.dart';
|
dbca8811
吴启风
fix: 修复视频兼容性并增加渲染...
|
6
|
import 'package:wow_english/common/utils/video_rendering_preference.dart';
|
3840b7fe
liangchengyou
feat:更新设置页面
|
7
|
import 'package:wow_english/common/widgets/we_app_bar.dart';
|
c5ed9934
xiaoyu
为清除缓存添加提示
|
8
|
import 'package:wow_english/utils/toast_util.dart';
|
3840b7fe
liangchengyou
feat:更新设置页面
|
9
10
11
12
13
14
15
16
|
import '../../../route/route.dart';
class SettingPage extends StatefulWidget {
const SettingPage({super.key});
@override
State<StatefulWidget> createState() {
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
17
|
return SettingPageState();
|
3840b7fe
liangchengyou
feat:更新设置页面
|
18
19
20
21
|
}
}
class SettingPageState extends State<SettingPage> {
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
22
23
|
String? _version;
String? _buildNum;
|
dbca8811
吴启风
fix: 修复视频兼容性并增加渲染...
|
24
|
bool _usePlatformView = false;
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
25
26
27
|
@override
void initState() {
super.initState();
|
dbca8811
吴启风
fix: 修复视频兼容性并增加渲染...
|
28
|
_usePlatformView = VideoRenderingPreference.usesPlatformView;
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
29
30
31
32
33
34
35
36
37
38
39
|
_retrieveVersionInfo();
}
Future<void> _retrieveVersionInfo() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
setState(() {
_version = packageInfo.version;
_buildNum = packageInfo.buildNumber;
});
}
|
3840b7fe
liangchengyou
feat:更新设置页面
|
40
41
|
@override
Widget build(BuildContext context) {
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
42
|
return Scaffold(
|
3840b7fe
liangchengyou
feat:更新设置页面
|
43
44
45
46
47
48
49
50
51
52
53
|
appBar: const WEAppBar(
titleText: '设置',
),
body: Container(
color: Colors.white,
padding: EdgeInsets.only(left: 17.w, right: 17.w),
child: SafeArea(
child: Center(
child: ListView(
children: [
34.verticalSpace,
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
54
|
_buildItemWidget('注销账号', onPress: () {
|
3840b7fe
liangchengyou
feat:更新设置页面
|
55
56
57
|
pushNamed(AppRouteName.deleteAccount);
}),
12.verticalSpace,
|
c5ed9934
xiaoyu
为清除缓存添加提示
|
58
59
60
61
62
63
64
|
_buildItemWidget('清除缓存', onPress: () {
EasyLoading.show();
Future.delayed(const Duration(seconds: 1), (){
showToast("清除成功");
EasyLoading.dismiss();
});
}),
|
3840b7fe
liangchengyou
feat:更新设置页面
|
65
|
12.verticalSpace,
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
66
|
_buildItemWidget('帮助与反馈', onPress: () {
|
3840b7fe
liangchengyou
feat:更新设置页面
|
67
68
|
pushNamed(AppRouteName.reBack);
}),
|
dbca8811
吴启风
fix: 修复视频兼容性并增加渲染...
|
69
70
71
72
|
if (defaultTargetPlatform == TargetPlatform.android) ...[
12.verticalSpace,
_buildVideoRenderingSetting(),
],
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
73
74
75
|
12.verticalSpace,
_buildItemWidget('Version: $_version Build:$_buildNum',
onPress: () {}),
|
3840b7fe
liangchengyou
feat:更新设置页面
|
76
77
78
79
80
81
82
|
],
),
),
),
),
);
}
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
83
|
|
dbca8811
吴启风
fix: 修复视频兼容性并增加渲染...
|
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
|
Widget _buildVideoRenderingSetting() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 10.h),
decoration: BoxDecoration(
border: Border.all(color: const Color(0xFF140C10), width: 1.5.w),
borderRadius: BorderRadius.circular(15.r),
color: Colors.white,
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'视频兼容模式',
style: TextStyle(
color: const Color(0xFF333333), fontSize: 19.sp),
),
4.verticalSpace,
Text(
_usePlatformView
? 'PlatformView(兼容测试)· 新打开的视频生效'
: 'Texture(默认)· 新打开的视频生效',
style: TextStyle(
color: const Color(0xFF777777), fontSize: 13.sp),
),
],
),
),
Switch.adaptive(
value: _usePlatformView,
onChanged: (value) async {
setState(() => _usePlatformView = value);
await VideoRenderingPreference.setUsesPlatformView(value);
showToast(value ? '已切换为 PlatformView' : '已切换为 Texture');
},
),
],
),
);
}
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
127
|
Widget _buildItemWidget(String text, {VoidCallback? onPress}) {
|
3840b7fe
liangchengyou
feat:更新设置页面
|
128
129
130
|
return OutlinedButton(
onPressed: () => onPress?.call(),
style: ButtonStyle(
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
131
132
133
134
|
side: MaterialStateProperty.all(
BorderSide(color: const Color(0xFF140C10), width: 1.5.w)),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.r))),
|
3840b7fe
liangchengyou
feat:更新设置页面
|
135
136
137
138
139
140
141
142
143
144
145
146
147
|
minimumSize: MaterialStateProperty.all(Size(double.infinity, 58.h)),
backgroundColor: MaterialStateProperty.all(Colors.white),
),
child: Text(
text,
style: TextStyle(
//fontWeight: FontWeight.w600,
color: const Color(0xFF333333),
fontSize: 21.sp,
),
),
);
}
|
d5fb5080
biao
设置页添加版本号 ,播放音频冗余代码删除
|
148
|
}
|