delete_account_page.dart
5.98 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
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/request/dao/user_dao.dart';
import 'package:wow_english/common/widgets/we_app_bar.dart';
import 'package:wow_english/utils/color_util.dart';
import '../../../common/dialogs/show_dialog.dart';
import '../../../route/route.dart';
class DeleteAccountPage extends StatefulWidget {
const DeleteAccountPage({super.key});
@override
State<StatefulWidget> createState() {
return DeleteAccountPageState();
}
}
class DeleteAccountPageState extends State<DeleteAccountPage> {
late String _text;
late TimerUtil _timerUtil;
late bool _endTime;
@override
void initState() {
super.initState();
_endTime = false;
_text = '请阅读注销条款15s';
_timerUtil = TimerUtil(mTotalTime: 15000);
_timerUtil.setOnTimerTickCallback((int tick) {
setState(() {
if (tick == 0) {
_endTime = true;
_text = '确认注销';
} else {
_text = '请阅读注销账号条款${tick~/1000}s';
}
});
});
_timerUtil.startCountDown();
}
void deleteAccount() async {
showTwoActionDialog(
'注销账号', '取消', '注销', '请谨慎操作,注销后不可恢复!',
leftTap: () {popPage();},
rightTap: () {
popPage();
UserDao.deleteAccount();
});
}
@override
void dispose() {
if (_timerUtil.isActive()) {
_timerUtil.cancel();
}
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const WEAppBar(
titleText: '注销账号',
),
body: Container(
color: Colors.white,
padding: EdgeInsets.only(
bottom: 20.h
),
child: SafeArea(
child: Center(
child: Column(
children: [
26.verticalSpace,
Expanded(
child: ListView(
children: [
RichText(
textAlign: TextAlign.left,
text: TextSpan(
children: [
TextSpan(
text: '注销账号条件:\n',
style: TextStyle(
fontSize: 17.sp,
color: const Color(0xFF333333),
fontWeight: FontWeight.bold
)
),
TextSpan(
text: '您提交注销申请后,wow english团队将对下列信息进行验证,以保证您的账号、财产安全:\n1.请确保帐户内没有余额。\n2.请确保账户内没有优惠券或其他卡券。\n3.请确保账户内没有虚拟财产权益。\n4.请确保账户内没有剩余课程\n5.请确保账户内没有VIP会员权益。\n\n',
style: TextStyle(
fontSize: 13.sp,
color: const Color(0xFF333333),
fontWeight: FontWeight.bold
)
),
TextSpan(
text: '注销账号须知:\n',
style: TextStyle(
fontSize: 17.sp,
color: const Color(0xFF333333),
fontWeight: FontWeight.bold
)
),
TextSpan(
text: '点击下方"确认注销”按钮,即表示您已阅读井同意《注销账号须知》\n1.注销账号是不可恢复的操作,请道慎操作,注销账号后,会永久删除账号下所有个人资料和历史信息,且无法找回。包括但不限于昵称头像、课程信息、关注、交易记录、余额、课时、优惠券、虚拟财产权益、VIP会员权益以及解除对外授权的绑定关系等。\n2.注销账号并不代表账号注销前的账号行为和相关责任得到豁免或减轻。\n3.操作前,请确认wow english账号内所有服务均己妥善处理,如因注销账号造成的损失,由您自行承担。',
style: TextStyle(
fontSize: 13.sp,
color: const Color(0xFF333333),
fontWeight: FontWeight.bold
)
)
]
),
)
],
),
),
14.verticalSpace,
InkWell(
onTap: () => deleteAccount(),
child: Container(
height: 40.h,
width: 430.w,
decoration: BoxDecoration(
color: _endTime?HexColor('#00B6F1'):HexColor('#C7C7C7'),
border: Border.all(
width: 1.5.w,
color: const Color(0xFF140C10)
),
borderRadius: BorderRadius.circular(15.r),
),
alignment: Alignment.center,
child: Text(
_text,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17.sp,
color: _endTime?Colors.white:const Color(0xFF333333)
),
),
),
)
],
),
),
),
),
);
}
}