车辆信息的部分
This commit is contained in:
BIN
ln_jq_app/assets/images/bg_map@2x.png
Normal file
BIN
ln_jq_app/assets/images/bg_map@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
BIN
ln_jq_app/assets/images/ic_car_bg@2x.png
Normal file
BIN
ln_jq_app/assets/images/ic_car_bg@2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
@@ -535,6 +535,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
String leftHydrogen = "0";
|
String leftHydrogen = "0";
|
||||||
num maxHydrogen = 0;
|
num maxHydrogen = 0;
|
||||||
String difference = "";
|
String difference = "";
|
||||||
|
var progressValue = 0.0;
|
||||||
|
|
||||||
//用来管理查看预约的弹窗
|
//用来管理查看预约的弹窗
|
||||||
Worker? _sheetWorker;
|
Worker? _sheetWorker;
|
||||||
@@ -675,6 +676,14 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
amountController.text = flooredDifference.toString();
|
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();
|
updateUi();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(height: 16.h),
|
SizedBox(height: 16.h),
|
||||||
_buildCarInfoCard(),
|
_buildCarInfoCard(),
|
||||||
SizedBox(height: 5),
|
SizedBox(height: 32.h),
|
||||||
_buildReservationFormCard(context),
|
_buildReservationFormCard(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -196,6 +196,9 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Widget _buildModernStatItem(String title, String subtitle, String value, String unit) {
|
Widget _buildModernStatItem(String title, String subtitle, String value, String unit) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -238,90 +241,70 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户信息卡片中的小统计项
|
|
||||||
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() {
|
Widget _buildCarInfoCard() {
|
||||||
return Card(
|
return Card(
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(11),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
// 左侧:车辆图片
|
||||||
Expanded(
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: LoginUtil.getAssImg('ic_car_bg@2x'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
// 右侧:信息与进度条
|
||||||
|
Expanded(
|
||||||
|
flex: 6,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
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),
|
const SizedBox(height: 12),
|
||||||
_buildInfoRow('剩余氢量:', '${controller.leftHydrogen}Kg'),
|
// 进度条部分
|
||||||
const SizedBox(height: 12),
|
Column(
|
||||||
_buildInfoRow('百公里氢耗:', '${controller.workEfficiency}KG/100KM'),
|
children: [
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
child: LinearProgressIndicator(
|
||||||
|
value: controller.progressValue,
|
||||||
|
minHeight: 6,
|
||||||
|
backgroundColor: Color(0xFFF0F2F5),
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(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 _buildCarDataItem(String label, String value) {
|
||||||
Widget _buildInfoRow(String label, String value) {
|
|
||||||
bool isButton = value == '扫码绑定';
|
|
||||||
return Row(
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(label, style: const TextStyle(fontSize: 13)),
|
Text(label, style: const TextStyle(fontSize: 12, color: Colors.grey)),
|
||||||
const SizedBox(width: 8),
|
Text(value, style: const TextStyle(fontSize: 12, fontWeight: FontWeight.bold, color: Colors.black87)),
|
||||||
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),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user