From a5e2a89e4fe2b8182dee40e097323a1c2a1b530c Mon Sep 17 00:00:00 2001 From: userGyl Date: Tue, 10 Feb 2026 11:51:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=88=97=E8=A1=A8=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reservation_list_bottomsheet.dart | 143 +++++++++--------- 1 file changed, 73 insertions(+), 70 deletions(-) diff --git a/ln_jq_app/lib/pages/c_page/reservation/reservation_list_bottomsheet.dart b/ln_jq_app/lib/pages/c_page/reservation/reservation_list_bottomsheet.dart index f4d3844..53f239b 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/reservation_list_bottomsheet.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/reservation_list_bottomsheet.dart @@ -36,19 +36,19 @@ class _ReservationListBottomSheetState extends State @override Widget build(BuildContext context) { return Container( - height: Get.height * 0.55, + height: Get.height * 0.6, decoration: const BoxDecoration( - color: Colors.white, + color: Color.fromRGBO(247, 249, 251, 1), borderRadius: BorderRadius.only( topLeft: Radius.circular(16), topRight: Radius.circular(16), ), ), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ // 构建标题和下拉框 _buildHeader(), - const Divider(height: 1), // 下拉筛选框 _buildChoice(), // 构建列表(使用 Obx 监听数据变化) @@ -60,58 +60,41 @@ class _ReservationListBottomSheetState extends State Container _buildChoice() { return Container( - padding: const EdgeInsets.fromLTRB(20, 8, 0, 0), - alignment: AlignmentGeometry.centerLeft, - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - color: Colors.grey[100], - borderRadius: BorderRadius.circular(8), - ), - child: DropdownButton( - value: _selectedStatus, - underline: const SizedBox.shrink(), // 隐藏下划线 - items: _statusOptions.entries.map((entry) { - return DropdownMenuItem( - value: entry.key, - child: Text(entry.value), - ); - }).toList(), - onChanged: (newValue) { - if (newValue != null) { - setState(() { - _selectedStatus = newValue; - }); - // 当选择新状态时,调用接口刷新数据 - _controller.getReservationList(addStatus: _selectedStatus); - } - }, - ), - ), - ); + padding: const EdgeInsets.fromLTRB(20, 8, 0, 0), + alignment: AlignmentGeometry.centerLeft, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 8), + decoration: BoxDecoration( + color: Colors.grey[100], + borderRadius: BorderRadius.circular(8), + ), + child: DropdownButton( + value: _selectedStatus, + underline: const SizedBox.shrink(), // 隐藏下划线 + items: _statusOptions.entries.map((entry) { + return DropdownMenuItem(value: entry.key, child: Text(entry.value)); + }).toList(), + onChanged: (newValue) { + if (newValue != null) { + setState(() { + _selectedStatus = newValue; + }); + // 当选择新状态时,调用接口刷新数据 + _controller.getReservationList(addStatus: _selectedStatus); + } + }, + ), + ), + ); } /// 构建标题、关闭按钮和下拉筛选框 Widget _buildHeader() { return Container( - padding: const EdgeInsets.fromLTRB(20, 8, 8, 8), - child: Stack( - alignment: Alignment.center, - children: [ - Center(child: const Text('我的预约', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),), - Align( - alignment: Alignment.centerRight, - child: ElevatedButton( - onPressed: () => Get.back(), - style: ElevatedButton.styleFrom( - elevation: 0, - backgroundColor: Colors.grey[200], - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), - ), - child: const Text('关闭', style: TextStyle(color: Colors.black54)), - ), - ), - ], + margin: const EdgeInsets.fromLTRB(20, 20, 8, 8), + child: const Text( + '我的预约', + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), ); } @@ -134,8 +117,8 @@ class _ReservationListBottomSheetState extends State return Card( color: Colors.white, margin: const EdgeInsets.only(bottom: 12.0), - elevation: 1, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + elevation: 0, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), child: Padding( padding: const EdgeInsets.all(16), child: Column( @@ -151,17 +134,20 @@ class _ReservationListBottomSheetState extends State vertical: 5, ), decoration: BoxDecoration( - color: Colors.blue.shade50, // 淡蓝色背景 + color: reservation.state == "-1" + ? Color.fromRGBO(241, 67, 56, 0.1) + : Color.fromRGBO(230, 249, 243, 1), borderRadius: BorderRadius.circular(4), // 小圆角 // 可以选择去掉边框,或者用极淡的边框 - border: Border.all(color: Colors.blue.shade100), ), child: Text( "${reservation.stateName}-${reservation.addStatusName}", style: TextStyle( - color: Colors.blue.shade700, - fontSize: 12, - fontWeight: FontWeight.w500, + color: reservation.state == "-1" + ? Color.fromRGBO(241, 67, 56, 0.8) + : Color.fromRGBO(49, 186, 133, 1), + fontSize: 12.sp, + fontWeight: FontWeight.w600, ), ), ), @@ -171,12 +157,10 @@ class _ReservationListBottomSheetState extends State SizedBox( height: 28, // 限制按钮高度,显得精致 child: OutlinedButton( - onPressed: () async{ + onPressed: () async { var responseData = await HttpService.to.post( 'appointment/orderAddHyd/vehicle-cancel', - data: { - 'id': reservation.id, - }, + data: {'id': reservation.id}, ); if (responseData == null || responseData.data == null) { @@ -203,19 +187,22 @@ class _ReservationListBottomSheetState extends State ), child: Text( '取消预约', - style: TextStyle(color: Colors.grey.shade600, fontSize: 12), + style: TextStyle( + color: Colors.grey.shade600, + fontSize: 12, + ), ), ), ), - SizedBox(width: 10.w,), + SizedBox(width: 10.w), // 修改按钮 (仅在 hasEdit 为 true 时显示) if (reservation.hasEdit) SizedBox( height: 28, child: OutlinedButton( - onPressed: () async{ + onPressed: () async { var result = await Get.to( - () => ReservationEditPage(), + () => ReservationEditPage(), arguments: { 'reservation': reservation, 'difference': _controller.difference, @@ -241,13 +228,14 @@ class _ReservationListBottomSheetState extends State '修改', style: TextStyle(color: Colors.blue, fontSize: 12), ), - ),), + ), + ), ], ), const SizedBox(height: 12), _buildDetailRow('车牌号:', reservation.plateNumber), _buildDetailRow('预约日期:', reservation.date), - _buildDetailRow('预约氢量:', reservation.hydAmount), + _buildDetailRow('预约氢量:', "${reservation.hydAmount} KG"), _buildDetailRow('加氢站:', reservation.stationName), _buildDetailRow('开始时间:', reservation.startTime), _buildDetailRow('结束时间:', reservation.endTime), @@ -271,11 +259,26 @@ class _ReservationListBottomSheetState extends State return Padding( padding: const EdgeInsets.only(top: 8.0), child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(label, style: const TextStyle(color: Colors.grey)), + Text( + label, + style: TextStyle( + color: Color.fromRGBO(51, 51, 51, 0.6), + fontSize: 14.sp, + fontWeight: FontWeight.w400, + ), + ), const SizedBox(width: 8), - Expanded( - child: Text(value, style: const TextStyle(fontWeight: FontWeight.w500)), + Text( + value, + style: TextStyle( + color: label.contains("预约氢量:") + ? Color.fromRGBO(27, 168, 85, 1) + : Color.fromRGBO(51, 51, 51, 1), + fontSize: 14.sp, + fontWeight: FontWeight.w500, + ), ), ], ),