| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  | import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart'; | 
					
						
							|  |  |  | import 'package:qhd_prevention/customWidget/toast_util.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-17 16:10:46 +08:00
										 |  |  | import 'package:qhd_prevention/pages/home/study/face_ecognition_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'package:qhd_prevention/pages/login_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-14 18:01:16 +08:00
										 |  |  | import 'package:qhd_prevention/pages/mine/mine_first_sign_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'package:qhd_prevention/pages/mine/mine_set_pwd_page.dart'; | 
					
						
							|  |  |  | import 'package:qhd_prevention/pages/my_appbar.dart'; | 
					
						
							| 
									
										
										
										
											2025-08-21 16:44:24 +08:00
										 |  |  | import 'package:qhd_prevention/services/auth_service.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'package:qhd_prevention/tools/h_colors.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import '../../tools/tools.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  | class MineSetPage extends StatefulWidget { | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |   const MineSetPage({super.key}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |   @override | 
					
						
							|  |  |  |   State<MineSetPage> createState() => _MineSetPageState(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class _MineSetPageState extends State<MineSetPage> { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /// 检查更新
 | 
					
						
							|  |  |  |   Future<void> _checkUpdate() async { | 
					
						
							|  |  |  |     LoadingDialogHelper.show(); | 
					
						
							|  |  |  |     final result = await AuthService.checkUpdate(); | 
					
						
							|  |  |  |     LoadingDialogHelper.hide(); | 
					
						
							|  |  |  |     if (FormUtils.hasValue(result, 'pd')) { | 
					
						
							|  |  |  |       // 有更新 提示更新
 | 
					
						
							|  |  |  |       Map pd = result['pd']; | 
					
						
							|  |  |  |       CustomAlertDialog.showConfirm( | 
					
						
							|  |  |  |           context, | 
					
						
							|  |  |  |           title: '更新通知', | 
					
						
							|  |  |  |           cancelText: '', | 
					
						
							|  |  |  |           confirmText: '我知道了', | 
					
						
							|  |  |  |           content: pd['UPLOAD_CONTENT'] ?? '', | 
					
						
							|  |  |  |           onConfirm: () { | 
					
						
							|  |  |  |             ToastUtil.showNormal(context, '更新去吧!'); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |     }else{ | 
					
						
							|  |  |  |       ToastUtil.showNormal(context, '已经是最新版本!'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     return Scaffold( | 
					
						
							|  |  |  |       appBar: MyAppbar(title: "设置"), | 
					
						
							|  |  |  |       backgroundColor: h_backGroundColor(), | 
					
						
							|  |  |  |       body: Column( | 
					
						
							|  |  |  |         children: [ | 
					
						
							|  |  |  |           GestureDetector( | 
					
						
							|  |  |  |             child: _setItemWidget("修改密码"), | 
					
						
							|  |  |  |             onTap: () { | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |               pushPage(const MineSetPwdPage(), context); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |           const Divider(height: 1, color: Colors.black12), | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-17 16:10:46 +08:00
										 |  |  |           GestureDetector( | 
					
						
							|  |  |  |             child: _setItemWidget("更新人脸信息"), | 
					
						
							|  |  |  |             onTap: () { | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |               pushPage( | 
					
						
							|  |  |  |                 const FaceRecognitionPage(studentId: '', mode: FaceMode.manual), | 
					
						
							|  |  |  |                 context, | 
					
						
							|  |  |  |               ); | 
					
						
							| 
									
										
										
										
											2025-07-17 16:10:46 +08:00
										 |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |           const Divider(height: 1, color: Colors.black12), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-14 18:01:16 +08:00
										 |  |  |           GestureDetector( | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |             child: _setItemWidget("更新签字信息"), | 
					
						
							|  |  |  |             onTap: () { | 
					
						
							|  |  |  |               pushPage(const FirstSignPage(), context); | 
					
						
							|  |  |  |               // pushPage(MineSignPage(), context);
 | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2025-07-14 18:01:16 +08:00
										 |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |           const Divider(height: 1, color: Colors.black12), | 
					
						
							| 
									
										
										
										
											2025-07-14 18:01:16 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |           GestureDetector( | 
					
						
							|  |  |  |             child: _setItemWidget("检查更新"), | 
					
						
							|  |  |  |             onTap: () { | 
					
						
							|  |  |  |               _checkUpdate(); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |           const SizedBox(height: 15), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |           GestureDetector( | 
					
						
							|  |  |  |             child: Container( | 
					
						
							|  |  |  |               padding: const EdgeInsets.symmetric(vertical: 15), | 
					
						
							|  |  |  |               color: Colors.white, | 
					
						
							|  |  |  |               child: const Center( | 
					
						
							|  |  |  |                 child: Text("退出当前账户", style: TextStyle(fontSize: 16)), | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             onTap: () async { | 
					
						
							|  |  |  |               CustomAlertDialog.showConfirm( | 
					
						
							|  |  |  |                 context, | 
					
						
							|  |  |  |                 title: '确认退出', | 
					
						
							|  |  |  |                 content: '确定要退出当前账号吗', | 
					
						
							|  |  |  |                 onConfirm: () async { | 
					
						
							|  |  |  |                   await AuthService.logout(); // ✅ 等待登出完成
 | 
					
						
							|  |  |  |                   if (!mounted) return; | 
					
						
							|  |  |  |                   Navigator.pushAndRemoveUntil( | 
					
						
							|  |  |  |                     context, | 
					
						
							|  |  |  |                     MaterialPageRoute(builder: (context) => const LoginPage()), | 
					
						
							|  |  |  |                         (Route<dynamic> route) => false, | 
					
						
							|  |  |  |                   ); | 
					
						
							|  |  |  |                 }, | 
					
						
							|  |  |  |               ); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |           ), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Widget _setItemWidget(final String text) { | 
					
						
							|  |  |  |     return Container( | 
					
						
							|  |  |  |       height: 55, | 
					
						
							|  |  |  |       color: Colors.white, | 
					
						
							|  |  |  |       child: Padding( | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |         padding: const EdgeInsets.all(15), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         child: Row( | 
					
						
							|  |  |  |           mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |           children: [ | 
					
						
							| 
									
										
										
										
											2025-08-19 11:06:16 +08:00
										 |  |  |             Text(text, style: const TextStyle(fontSize: 16)), | 
					
						
							|  |  |  |             const Icon(Icons.chevron_right), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |           ], | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |