| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  | import 'package:qhd_prevention/customWidget/toast_util.dart'; | 
					
						
							|  |  |  | import 'package:qhd_prevention/http/ApiService.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'package:qhd_prevention/pages/app/Danger_paicha/check_record_page.dart'; | 
					
						
							|  |  |  | import 'package:qhd_prevention/pages/app/Danger_paicha/quick_report_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | import 'package:qhd_prevention/pages/app/danger_wait_list_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-09-23 10:31:41 +08:00
										 |  |  | import 'package:qhd_prevention/pages/app/gy_alarm/gy_alarm_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  | import 'package:qhd_prevention/pages/badge_manager.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import 'package:qhd_prevention/pages/home/work/risk_list_page.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import '../../tools/tools.dart'; | 
					
						
							|  |  |  | import '../home/userInfo_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-24 20:01:23 +08:00
										 |  |  | import 'ai_alarm_page.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | import '../home/work/danger_page.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum AppItem { | 
					
						
							|  |  |  |   riskInspection,    // 隐患排查
 | 
					
						
							|  |  |  |   quickReport,       // 隐患快报
 | 
					
						
							|  |  |  |   checkRecord,       // 检查记录
 | 
					
						
							|  |  |  |   riskRecord,        // 隐患记录
 | 
					
						
							|  |  |  |   pendingRectification, // 待整改隐患
 | 
					
						
							|  |  |  |   overdueRectification, // 超期未整改
 | 
					
						
							|  |  |  |   riskAcceptance,    // 隐患验收
 | 
					
						
							|  |  |  |   acceptedRisk,      // 已验收隐患
 | 
					
						
							|  |  |  |   specialRectification, // 专项检查中的隐患整改
 | 
					
						
							|  |  |  |   specialRecord,     // 专项检查中的隐患记录
 | 
					
						
							|  |  |  |   supervisionRectification, // 监管帮扶中的隐患整改
 | 
					
						
							|  |  |  |   supervisionRecord, // 监管帮扶中的隐患记录
 | 
					
						
							| 
									
										
										
										
											2025-09-23 10:31:41 +08:00
										 |  |  |   aiAlarm, // 检测预警-AI预警
 | 
					
						
							|  |  |  |   gyAlarm // 检测预警-工艺报警优化
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  | class ApplicationPage extends StatefulWidget { | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |   const ApplicationPage({Key? key}) : super(key: key); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |   @override | 
					
						
							|  |  |  |   State<ApplicationPage> createState() => _ApplicationPageState(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class _ApplicationPageState extends State<ApplicationPage> { | 
					
						
							|  |  |  |   final badgeManager = BadgeManager(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   void initState() { | 
					
						
							|  |  |  |     // TODO: implement initState
 | 
					
						
							|  |  |  |     super.initState(); | 
					
						
							|  |  |  |     BadgeManager().addListener(_onBadgeChanged); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   void _onBadgeChanged() { | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |     // setState(() {});
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |   // 处理项目点击事件
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |   void _handleItemClick(BuildContext context, AppItem item) async{ | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |     switch (item) { | 
					
						
							| 
									
										
										
										
											2025-08-06 09:19:51 +08:00
										 |  |  |       case AppItem.quickReport: | 
					
						
							|  |  |  |       // 跳转到隐患快报页面
 | 
					
						
							|  |  |  |         pushPage(QuickReportPage(), context); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |       case AppItem.riskInspection: | 
					
						
							|  |  |  |       // 跳转到隐患排查页面
 | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |       LoadingDialogHelper.show(); | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |         bool isRest= await _getIsRest(); | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |         LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |         if(isRest){ | 
					
						
							|  |  |  |           ToastUtil.showNormal(context, "您已经处于离岗状态中"); | 
					
						
							|  |  |  |           return; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-07-31 21:15:00 +08:00
										 |  |  |         pushPage(DangerPage(1), context); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.checkRecord: | 
					
						
							|  |  |  |       // 跳转到检查记录页面
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |         pushPage(CheckRecordPage(1), context); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.specialRectification: | 
					
						
							|  |  |  |       // 跳转到专项检查隐患整改页面
 | 
					
						
							|  |  |  |       //Navigator.push(context, MaterialPageRoute(builder: (_) => SpecialRectificationPage()));
 | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.specialRecord: | 
					
						
							|  |  |  |       // 跳转到专项检查隐患记录页面
 | 
					
						
							|  |  |  |       // Navigator.push(context, MaterialPageRoute(builder: (_) => SpecialRecordPage()));
 | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.supervisionRectification: | 
					
						
							|  |  |  |       // 跳转到监管帮扶隐患整改页面
 | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |         LoadingDialogHelper.show(); | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |         bool isRest= await _getIsRest(); | 
					
						
							| 
									
										
										
										
											2025-09-03 18:03:04 +08:00
										 |  |  |         LoadingDialogHelper.hide(); | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  |         if(isRest){ | 
					
						
							|  |  |  |           ToastUtil.showNormal(context, "您已经处于离岗状态中"); | 
					
						
							|  |  |  |           return; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-07-31 21:15:00 +08:00
										 |  |  |         pushPage(DangerPage(2), context); | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |         //Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRectificationPage()));
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.supervisionRecord: | 
					
						
							|  |  |  |       // 跳转到监管帮扶隐患记录页面
 | 
					
						
							|  |  |  |       //Navigator.push(context, MaterialPageRoute(builder: (_) => SupervisionRecordPage()));
 | 
					
						
							| 
									
										
										
										
											2025-07-30 10:47:52 +08:00
										 |  |  |         pushPage(CheckRecordPage(2), context); | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         break; | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       case AppItem.riskRecord: | 
					
						
							|  |  |  |       // 跳转到隐患记录页面
 | 
					
						
							|  |  |  |         pushPage(DangerWaitListPage(DangerType.ristRecord,1), context); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.pendingRectification: | 
					
						
							|  |  |  |       // 跳转到待整改隐患页面
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |         await pushPage(DangerWaitListPage(DangerType.wait,2), context); | 
					
						
							|  |  |  |         badgeManager.updateAppCount(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.overdueRectification: | 
					
						
							|  |  |  |       // 跳转到超期未整改页面
 | 
					
						
							|  |  |  |         pushPage(DangerWaitListPage(DangerType.expired,3), context); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.riskAcceptance: | 
					
						
							|  |  |  |       // 跳转到隐患验收页面
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |         await pushPage(DangerWaitListPage(DangerType.waitAcceptance,4), context); | 
					
						
							|  |  |  |         badgeManager.updateAppCount(); | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.acceptedRisk: | 
					
						
							|  |  |  |       // 跳转到已验收隐患页面
 | 
					
						
							|  |  |  |         pushPage(DangerWaitListPage(DangerType.acceptanced,5), context); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.aiAlarm: | 
					
						
							| 
									
										
										
										
											2025-07-30 10:47:52 +08:00
										 |  |  |       // ai
 | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |         pushPage(AiAlarmPage(), context); | 
					
						
							| 
									
										
										
										
											2025-09-23 10:31:41 +08:00
										 |  |  |         break; | 
					
						
							|  |  |  |       case AppItem.gyAlarm: | 
					
						
							|  |  |  |         pushPage(GyAlarmPage(), context); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |         break; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     // 使用枚举定义项目
 | 
					
						
							|  |  |  |     final List<Map<String, dynamic>> buttonInfos = [ | 
					
						
							|  |  |  |       { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         'title': '隐患快报', | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         'list': [ | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |           {'item': AppItem.quickReport, 'icon': 'assets/icon-apps/icon-pc-1.png', 'title': '隐患快报', 'num': 0}, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |         'title': '隐患排查', | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         'list': [ | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |           {'item': AppItem.riskInspection, 'icon': 'assets/icon-apps/icon-zl-6.png', 'title': '隐患排查', 'num': 0}, | 
					
						
							|  |  |  |           {'item': AppItem.checkRecord, 'icon': 'assets/icon-apps/icon-zl-2.png', 'title': '检查记录', 'num': 0}, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							| 
									
										
										
										
											2025-07-30 10:47:52 +08:00
										 |  |  |         'title': '标准排查', | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         'list': [ | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |           {'item': AppItem.supervisionRectification, 'icon': 'assets/icon-apps/icon-zl-6.png', 'title': '标准排查', 'num': 0}, | 
					
						
							| 
									
										
										
										
											2025-07-25 18:06:37 +08:00
										 |  |  |           {'item': AppItem.supervisionRecord, 'icon': 'assets/icon-apps/icon-zl-2.png', 'title': '检查记录', 'num': 0}, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         'title': '隐患治理', | 
					
						
							|  |  |  |         'list': [ | 
					
						
							|  |  |  |           {'item': AppItem.riskRecord, 'icon': 'assets/icon-apps/icon-zl-2.png', 'title': '隐患记录', 'num': 0}, | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |           {'item': AppItem.pendingRectification, 'icon': 'assets/icon-apps/icon-zl-3.png', 'title': '待整改隐患', 'num': badgeManager.appDzgCount}, | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |           {'item': AppItem.overdueRectification, 'icon': 'assets/icon-apps/icon-zl-4.png', 'title': '超期未整改', 'num': 0}, | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  |           {'item': AppItem.riskAcceptance, 'icon': 'assets/icon-apps/icon-yh-1.png', 'title': '隐患验收', 'num': badgeManager.appDysCount}, | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |           {'item': AppItem.acceptedRisk, 'icon': 'assets/icon-apps/icon-zl-1.png', 'title': '已验收隐患', 'num': 0}, | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         'title': '监测预警', | 
					
						
							|  |  |  |         'list': [ | 
					
						
							|  |  |  |           {'item': AppItem.aiAlarm, 'icon': 'assets/icon-apps/icon-pc-1.png', 'title': 'AI报警', 'num': 0}, | 
					
						
							| 
									
										
										
										
											2025-09-23 10:31:41 +08:00
										 |  |  |           {'item': AppItem.gyAlarm, 'icon': 'assets/icon-apps/icon-pc-1.png', 'title': '工艺报警优化', 'num': 0}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return Scaffold( | 
					
						
							|  |  |  |       body: ListView.builder( | 
					
						
							|  |  |  |         physics: const AlwaysScrollableScrollPhysics(), | 
					
						
							|  |  |  |         padding: const EdgeInsets.all(0), | 
					
						
							|  |  |  |         itemCount: buttonInfos.length + 1, | 
					
						
							|  |  |  |         itemBuilder: (context, index) { | 
					
						
							|  |  |  |           if (index == 0) { | 
					
						
							|  |  |  |             return ClipRRect( | 
					
						
							|  |  |  |               child: Image.asset( | 
					
						
							| 
									
										
										
										
											2025-07-16 18:07:10 +08:00
										 |  |  |                 'assets/images/apps-banner.png', | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |                 fit: BoxFit.cover, | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           final section = buttonInfos[index - 1]; | 
					
						
							|  |  |  |           final items = section['list'] as List<dynamic>; | 
					
						
							|  |  |  |           return Padding( | 
					
						
							|  |  |  |             padding: const EdgeInsets.only(top: 10), | 
					
						
							|  |  |  |             child: Container( | 
					
						
							|  |  |  |               decoration: BoxDecoration( | 
					
						
							|  |  |  |                 color: Colors.white, | 
					
						
							|  |  |  |                 borderRadius: BorderRadius.circular(8), | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |               child: Column( | 
					
						
							|  |  |  |                 crossAxisAlignment: CrossAxisAlignment.start, | 
					
						
							|  |  |  |                 children: [ | 
					
						
							|  |  |  |                   Padding( | 
					
						
							|  |  |  |                     padding: const EdgeInsets.fromLTRB(10, 10, 10, 5), | 
					
						
							|  |  |  |                     child: Row( | 
					
						
							|  |  |  |                       children: [ | 
					
						
							|  |  |  |                         Container(width: 2, height: 10, color: Colors.blue), | 
					
						
							|  |  |  |                         const SizedBox(width: 5), | 
					
						
							|  |  |  |                         Text( | 
					
						
							|  |  |  |                           section['title'] as String, | 
					
						
							|  |  |  |                           style: const TextStyle( | 
					
						
							|  |  |  |                             fontSize: 14, | 
					
						
							|  |  |  |                             fontWeight: FontWeight.bold, | 
					
						
							|  |  |  |                           ), | 
					
						
							|  |  |  |                         ), | 
					
						
							|  |  |  |                       ], | 
					
						
							|  |  |  |                     ), | 
					
						
							|  |  |  |                   ), | 
					
						
							|  |  |  |                   Padding( | 
					
						
							|  |  |  |                     padding: const EdgeInsets.all(10), | 
					
						
							|  |  |  |                     child: LayoutBuilder( | 
					
						
							|  |  |  |                       builder: (context, constraints) { | 
					
						
							|  |  |  |                         const spacing = 10.0; | 
					
						
							|  |  |  |                         final totalWidth = constraints.maxWidth; | 
					
						
							|  |  |  |                         final itemWidth = (totalWidth - spacing * 3) / 4; | 
					
						
							|  |  |  |                         return Wrap( | 
					
						
							|  |  |  |                           spacing: spacing, | 
					
						
							|  |  |  |                           runSpacing: spacing, | 
					
						
							|  |  |  |                           children: items.map<Widget>((item) { | 
					
						
							|  |  |  |                             return SizedBox( | 
					
						
							|  |  |  |                               width: itemWidth, | 
					
						
							|  |  |  |                               child: _buildItem( | 
					
						
							|  |  |  |                                 item, | 
					
						
							|  |  |  |                                 onTap: () => _handleItemClick(context, item['item'] as AppItem), | 
					
						
							|  |  |  |                               ), | 
					
						
							|  |  |  |                             ); | 
					
						
							|  |  |  |                           }).toList(), | 
					
						
							|  |  |  |                         ); | 
					
						
							|  |  |  |                       }, | 
					
						
							|  |  |  |                     ), | 
					
						
							|  |  |  |                   ), | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ); | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // 添加 onTap 回调参数
 | 
					
						
							|  |  |  |   Widget _buildItem(Map<String, dynamic> item, {VoidCallback? onTap}) { | 
					
						
							|  |  |  |     const double size = 60; | 
					
						
							|  |  |  |     final int badgeNum = item['num'] as int; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return InkWell( | 
					
						
							|  |  |  |       onTap: onTap, // 添加点击事件
 | 
					
						
							|  |  |  |       borderRadius: BorderRadius.circular(8), | 
					
						
							|  |  |  |       child: SizedBox( | 
					
						
							|  |  |  |         width: size, | 
					
						
							|  |  |  |         child: Column( | 
					
						
							|  |  |  |           mainAxisSize: MainAxisSize.min, | 
					
						
							|  |  |  |           children: [ | 
					
						
							|  |  |  |             Stack( | 
					
						
							|  |  |  |               clipBehavior: Clip.none, | 
					
						
							|  |  |  |               children: [ | 
					
						
							|  |  |  |                 SizedBox( | 
					
						
							|  |  |  |                   width: 30, | 
					
						
							|  |  |  |                   height: 30, | 
					
						
							|  |  |  |                   child: Image.asset(item['icon'] as String, fit: BoxFit.contain), | 
					
						
							|  |  |  |                 ), | 
					
						
							|  |  |  |                 if (badgeNum > 0) | 
					
						
							|  |  |  |                   Positioned( | 
					
						
							|  |  |  |                     top: -5, | 
					
						
							|  |  |  |                     right: -10, | 
					
						
							|  |  |  |                     child: Container( | 
					
						
							|  |  |  |                       width: 16, | 
					
						
							|  |  |  |                       height: 16, | 
					
						
							|  |  |  |                       decoration: const BoxDecoration( | 
					
						
							|  |  |  |                         color: Colors.red, | 
					
						
							|  |  |  |                         shape: BoxShape.circle, | 
					
						
							|  |  |  |                       ), | 
					
						
							|  |  |  |                       alignment: Alignment.center, | 
					
						
							|  |  |  |                       child: Text( | 
					
						
							|  |  |  |                         badgeNum.toString(), | 
					
						
							|  |  |  |                         style: const TextStyle(color: Colors.white, fontSize: 10), | 
					
						
							|  |  |  |                       ), | 
					
						
							|  |  |  |                     ), | 
					
						
							|  |  |  |                   ), | 
					
						
							|  |  |  |               ], | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |             const SizedBox(height: 4), | 
					
						
							|  |  |  |             Text( | 
					
						
							|  |  |  |               item['title'] as String, | 
					
						
							|  |  |  |               style: const TextStyle(fontSize: 12), | 
					
						
							|  |  |  |               textAlign: TextAlign.center, | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ], | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-08-29 10:00:35 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   Future<bool> _getIsRest( )async { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |       final raw = await ApiService.getIsRest(); | 
					
						
							|  |  |  |       if (raw['result'] == 'success') { | 
					
						
							|  |  |  |         if(  raw['ISREST']=="1"){ | 
					
						
							|  |  |  |           return true; | 
					
						
							|  |  |  |         }else{ | 
					
						
							|  |  |  |           return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }else{ | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } catch (e) { | 
					
						
							|  |  |  |       // 出错时可以 Toast 或者在页面上显示错误状态
 | 
					
						
							|  |  |  |       print('加载头像数据失败:$e'); | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-08 10:52:15 +08:00
										 |  |  | } |