diff --git a/ln_jq_app/assets/images/bg_map@2x.png b/ln_jq_app/assets/images/bg_map@2x.png new file mode 100644 index 0000000..4e53864 Binary files /dev/null and b/ln_jq_app/assets/images/bg_map@2x.png differ diff --git a/ln_jq_app/assets/images/ic_car_bg@2x.png b/ln_jq_app/assets/images/ic_car_bg@2x.png new file mode 100644 index 0000000..dcfe4fb Binary files /dev/null and b/ln_jq_app/assets/images/ic_car_bg@2x.png differ diff --git a/ln_jq_app/lib/pages/c_page/reservation/controller.dart b/ln_jq_app/lib/pages/c_page/reservation/controller.dart index 5371a09..9def2c6 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/controller.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/controller.dart @@ -535,6 +535,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin { String leftHydrogen = "0"; num maxHydrogen = 0; String difference = ""; + var progressValue = 0.0; //用来管理查看预约的弹窗 Worker? _sheetWorker; @@ -675,6 +676,14 @@ class C_ReservationController extends GetxController with BaseControllerMixin { amountController.text = flooredDifference.toString(); } + if (maxHydrogen > 0) { + progressValue = leftHydrogenNum / maxHydrogen; + + // 边界处理:确保值在 0 到 1 之间 + if (progressValue > 1.0) progressValue = 1.0; + if (progressValue < 0.0) progressValue = 0.0; + } + updateUi(); } catch (e) { } finally { diff --git a/ln_jq_app/lib/pages/c_page/reservation/view.dart b/ln_jq_app/lib/pages/c_page/reservation/view.dart index 80a3330..f650602 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/view.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/view.dart @@ -46,7 +46,7 @@ class ReservationPage extends GetView { children: [ SizedBox(height: 16.h), _buildCarInfoCard(), - SizedBox(height: 5), + SizedBox(height: 32.h), _buildReservationFormCard(context), ], ), @@ -196,6 +196,9 @@ class ReservationPage extends GetView { ); } + + + Widget _buildModernStatItem(String title, String subtitle, String value, String unit) { return Expanded( child: Container( @@ -238,90 +241,70 @@ class ReservationPage extends GetView { ); } - // 用户信息卡片中的小统计项 - Widget _buildStatItem(String value, String label) { - return Column( - children: [ - Text(value, style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold)), - const SizedBox(height: 4), - Text(label, style: const TextStyle(color: Colors.grey, fontSize: 11)), - ], - ); - } - /// 构建车辆信息卡片 Widget _buildCarInfoCard() { return Card( elevation: 2, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + color: Colors.white, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), child: Padding( - padding: const EdgeInsets.all(11), + padding: const EdgeInsets.all(16.0), child: Row( children: [ + // 左侧:车辆图片 Expanded( + flex: 4, + child: LoginUtil.getAssImg('ic_car_bg@2x'), + ), + const SizedBox(width: 16), + // 右侧:信息与进度条 + Expanded( + flex: 6, child: Column( children: [ - _buildInfoRow('车牌号: ${controller.plateNumber}', '扫码绑定'), + _buildCarDataItem('剩余电量', '36.8%'), + const SizedBox(height: 8), + _buildCarDataItem('剩余氢量', '${controller.leftHydrogen}Kg'), + const SizedBox(height: 8), + _buildCarDataItem('百公里氢耗', '${controller.workEfficiency}Kg'), const SizedBox(height: 12), - _buildInfoRow('剩余氢量:', '${controller.leftHydrogen}Kg'), - const SizedBox(height: 12), - _buildInfoRow('百公里氢耗:', '${controller.workEfficiency}KG/100KM'), + // 进度条部分 + Column( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(4), + child: LinearProgressIndicator( + value: controller.progressValue, + minHeight: 6, + backgroundColor: Color(0xFFF0F2F5), + valueColor: AlwaysStoppedAnimation(Color(0xFF006633)), + ), + ), + const SizedBox(height: 4), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text("剩余氢量", style: TextStyle(fontSize: 10, color: Colors.grey)), + Text("${controller.leftHydrogen}Kg", style: const TextStyle(fontSize: 10, color: Color(0xFF006633), fontWeight: FontWeight.bold)), + ], + ), + ], + ), ], ), ), - const SizedBox(width: 8), - Icon(Icons.propane_rounded, size: 50, color: Colors.blue.withOpacity(0.5)), ], ), ), ); } - // 车辆信息卡片中的信息行 - Widget _buildInfoRow(String label, String value) { - bool isButton = value == '扫码绑定'; + Widget _buildCarDataItem(String label, String value) { return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(label, style: const TextStyle(fontSize: 13)), - const SizedBox(width: 8), - isButton - ? GestureDetector( - onTap: () async { - controller.doQrCode(); - }, - child: Container( - margin: EdgeInsetsGeometry.only(left: 10.w), - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5), - decoration: BoxDecoration( - border: Border.all(color: Colors.blue.shade300, width: 1), - borderRadius: BorderRadius.circular(5), - color: Colors.blue.withOpacity(0.05), - ), - child: Row( - mainAxisSize: MainAxisSize.min, // Keep the row compact - children: [ - Icon( - StorageService.to.hasVehicleInfo ? Icons.repeat : Icons.search, - size: 13, - color: Colors.blue, - ), - const SizedBox(width: 3), - Text( - StorageService.to.hasVehicleInfo ? "换车牌" : value, - style: const TextStyle( - color: Colors.blue, - fontSize: 11, - fontWeight: FontWeight.w500, - ), - ), - ], - ), - ), - ) - : Text( - value, - style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500), - ), + Text(label, style: const TextStyle(fontSize: 12, color: Colors.grey)), + Text(value, style: const TextStyle(fontSize: 12, fontWeight: FontWeight.bold, color: Colors.black87)), ], ); }