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 createState() { return DeleteAccountPageState(); } } class DeleteAccountPageState extends State { 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) ), ), ), ) ], ), ), ), ), ); } }