| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2025-09-10 15:50:05 +08:00
										 |  |  |  | import 'package:qhd_prevention/customWidget/toast_util.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |  | import 'package:qhd_prevention/pages/my_appbar.dart'; | 
					
						
							|  |  |  |  | import 'package:qhd_prevention/tools/tools.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-23 20:14:38 +08:00
										 |  |  |  | import '../../http/ApiService.dart'; | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |  | import '/customWidget/search_bar_widget.dart'; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class LowPage extends StatefulWidget { | 
					
						
							|  |  |  |  |   const LowPage({super.key}); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   @override | 
					
						
							|  |  |  |  |   State<LowPage> createState() => _LowPagePageState(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class _LowPagePageState extends State<LowPage> { | 
					
						
							|  |  |  |  |   // 模拟数据
 | 
					
						
							|  |  |  |  |   final List<Map<String, dynamic>> _dataInfos = List.generate(10, (i) { | 
					
						
							|  |  |  |  |     return { | 
					
						
							|  |  |  |  |       'title': '测试数据标题标题 ${i + 1}', | 
					
						
							|  |  |  |  |     }; | 
					
						
							|  |  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2025-07-23 20:14:38 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |  |   final TextEditingController _searchController = TextEditingController(); | 
					
						
							| 
									
										
										
										
											2025-07-23 20:14:38 +08:00
										 |  |  |  |   String treeJson=""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   @override | 
					
						
							|  |  |  |  |   void initState() { | 
					
						
							|  |  |  |  |     // TODO: implement initState
 | 
					
						
							|  |  |  |  |     super.initState(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     _getLowList(); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   Future<void> _getLowList() async { | 
					
						
							|  |  |  |  |     try { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       final result = await ApiService.getHiddenTreatmentListTree(); | 
					
						
							|  |  |  |  |       if (result['result'] == 'success') { | 
					
						
							|  |  |  |  |         setState(() { | 
					
						
							|  |  |  |  |           treeJson= result['zTreeNodes']; | 
					
						
							|  |  |  |  |         }); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       }else{ | 
					
						
							| 
									
										
										
										
											2025-09-10 15:50:05 +08:00
										 |  |  |  |         ToastUtil.showNormal(context, "加载数据失败"); | 
					
						
							|  |  |  |  |         // _showMessage('加载数据失败');
 | 
					
						
							| 
									
										
										
										
											2025-07-23 20:14:38 +08:00
										 |  |  |  |       } | 
					
						
							|  |  |  |  |     } catch (e) { | 
					
						
							|  |  |  |  |       // 出错时可以 Toast 或者在页面上显示错误状态
 | 
					
						
							|  |  |  |  |       print('加载数据失败:$e'); | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   @override | 
					
						
							|  |  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |  |     return Scaffold( | 
					
						
							|  |  |  |  |       appBar: MyAppbar( | 
					
						
							|  |  |  |  |         title: "法律法规", | 
					
						
							|  |  |  |  |       ), | 
					
						
							| 
									
										
										
										
											2025-07-23 20:14:38 +08:00
										 |  |  |  |       body: SafeArea( | 
					
						
							|  |  |  |  |           child: _vcDetailWidget() | 
					
						
							|  |  |  |  |       ), | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |  |     ); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   Widget _vcDetailWidget() { | 
					
						
							|  |  |  |  |     return Column( | 
					
						
							|  |  |  |  |       children: [ | 
					
						
							|  |  |  |  |         Padding( | 
					
						
							|  |  |  |  |           padding: EdgeInsets.all(10), | 
					
						
							|  |  |  |  |           child: SearchBarWidget( | 
					
						
							|  |  |  |  |             controller: _searchController, | 
					
						
							|  |  |  |  |             onSearch: (keyboard) { | 
					
						
							|  |  |  |  |               // 输入请求接口
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             }, | 
					
						
							|  |  |  |  |           ), | 
					
						
							|  |  |  |  |         ), | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         // 修复:使用Expanded包裹ListView确保正确高度
 | 
					
						
							|  |  |  |  |         Expanded( | 
					
						
							|  |  |  |  |           child: ListView.separated( | 
					
						
							|  |  |  |  |             separatorBuilder: (_, __) => const Divider(height: 0.5, color: Colors.black12,), | 
					
						
							|  |  |  |  |             itemCount: _dataInfos.length, | 
					
						
							|  |  |  |  |             itemBuilder: (context, index) { | 
					
						
							|  |  |  |  |               final item = _dataInfos[index]; | 
					
						
							|  |  |  |  |               return _fxitemCell(item); | 
					
						
							|  |  |  |  |             }, | 
					
						
							|  |  |  |  |           ), | 
					
						
							|  |  |  |  |         ), | 
					
						
							|  |  |  |  |       ], | 
					
						
							|  |  |  |  |     ); | 
					
						
							|  |  |  |  |   } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   Widget _fxitemCell(final item) { | 
					
						
							|  |  |  |  |     String title = item['title']; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     return Container( | 
					
						
							|  |  |  |  |       height: 50, | 
					
						
							|  |  |  |  |       color: Colors.white, | 
					
						
							|  |  |  |  |       padding: EdgeInsets.symmetric(horizontal: 16), // 添加水平内边距
 | 
					
						
							|  |  |  |  |       child: Row( | 
					
						
							|  |  |  |  |         mainAxisAlignment: MainAxisAlignment.spaceBetween, | 
					
						
							|  |  |  |  |         children: [ | 
					
						
							|  |  |  |  |           Text(title),  | 
					
						
							|  |  |  |  |           Icon(Icons.arrow_forward_ios, color: Colors.black26,) | 
					
						
							|  |  |  |  |         ], | 
					
						
							|  |  |  |  |       ), | 
					
						
							|  |  |  |  |     ); | 
					
						
							|  |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-23 20:14:38 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   void _showMessage(String msg) { | 
					
						
							| 
									
										
										
										
											2025-09-15 15:54:03 +08:00
										 |  |  |  |     ToastUtil.showNormal(context, msg); | 
					
						
							| 
									
										
										
										
											2025-07-23 20:14:38 +08:00
										 |  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-07-11 11:03:21 +08:00
										 |  |  |  | } |