车辆样式调整

This commit is contained in:
2026-01-23 10:49:02 +08:00
parent 5236670e7c
commit aabfbfae0c

View File

@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getx_scaffold/getx_scaffold.dart';
import 'package:ln_jq_app/common/login_util.dart';
import 'package:ln_jq_app/common/styles/theme.dart';
import 'package:ln_jq_app/pages/c_page/message/view.dart';
import 'package:ln_jq_app/pages/qr_code/view.dart';
import 'package:ln_jq_app/storage_service.dart';
import '../../../common/styles/theme.dart';
import 'controller.dart';
class CarInfoPage extends GetView<CarInfoController> {
@@ -29,7 +29,7 @@ class CarInfoPage extends GetView<CarInfoController> {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 5),
_buildCarBindingCard(),
_buildCarInfoCard(),
const SizedBox(height: 5),
_buildCertificatesCard(),
const SizedBox(height: 5),
@@ -216,98 +216,108 @@ class CarInfoPage extends GetView<CarInfoController> {
);
}
// 司机信息卡片中的小统计项
Widget _buildStatItem(String value, String label) {
return Column(
children: [
Text(
value,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.blue,
),
),
const SizedBox(height: 4),
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 12)),
],
);
}
/// 构建车辆绑定信息卡片
Widget _buildCarBindingCard() {
/// 构建车辆信息卡片
Widget _buildCarInfoCard() {
return Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
child: Padding(
padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 18,top: 16),
child: Row(
children: [
Expanded(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
_buildInfoRow('车牌号: ${controller.plateNumber}', '扫码绑定'),
_buildDetailRow('车牌号', controller.plateNumber, isPlate: true),
const SizedBox(height: 12),
_buildInfoRow('车架号:', '${controller.vin}'),
_buildDetailRow('车架号', controller.vin),
const SizedBox(height: 12),
_buildInfoRow('车辆型号:', '${controller.modelName}'),
_buildDetailRow('车辆型号', controller.modelName),
const SizedBox(height: 12),
_buildInfoRow('车辆品牌:', '${controller.brandName}'),
],
),
),
const SizedBox(width: 8),
Icon(Icons.propane_rounded, size: 50, color: Colors.blue.withOpacity(0.5)),
_buildDetailRow('车辆品牌', controller.brandName),
const SizedBox(height: 24),
_buildH2LevelProgress(),
],
),
),
);
}
// 车辆绑定卡片中的信息行
Widget _buildInfoRow(String label, String value) {
bool isButton = value == '扫码绑定';
/// 详情行:左右分布
Widget _buildDetailRow(String label, String value, {bool isPlate = false}) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label, style: const TextStyle(fontSize: 13)),
const SizedBox(width: 8),
isButton
? GestureDetector(
onTap: () async {
controller.doQrCode();
},
Text(label, style: const TextStyle(fontSize: 13, color: Colors.grey)),
Row(
mainAxisSize: MainAxisSize.min,
children: [
if (isPlate)
GestureDetector(
onTap: () => controller.doQrCode(),
child: Container(
margin: EdgeInsetsGeometry.only(left: 10.w),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
margin: const EdgeInsets.only(right: 10),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(
border: Border.all(color: Colors.blue.shade300, width: 1),
borderRadius: BorderRadius.circular(5),
color: Colors.blue.withOpacity(0.05),
border: Border.all(color: Color.fromRGBO(71, 174, 208, 1)), // 浅绿色边框
borderRadius: BorderRadius.circular(12),
color: Color.fromRGBO(235, 250, 255, 1), // 极浅绿色背景
),
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),
Icon(Icons.sync, size: 12, color: Color.fromRGBO(71, 174, 208, 1)),
SizedBox(width: 4),
Text(
StorageService.to.hasVehicleInfo ? "换车牌" : value,
style: const TextStyle(
color: Colors.blue,
fontSize: 11,
fontWeight: FontWeight.w500,
StorageService.to.hasVehicleInfo ? "换车牌" : "扫码绑定",
style: TextStyle(
color: Color.fromRGBO(71, 174, 208, 1),
fontSize: 10,
fontWeight: FontWeight.bold,
),
),
],
),
),
)
: Text(
),
Text(
value,
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500),
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.black87,
),
),
],
),
],
);
}
/// H2 Level 进度条模块
Widget _buildH2LevelProgress() {
return Column(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(4),
child: const LinearProgressIndicator(
value: 0.75, // 示例值
minHeight: 8,
backgroundColor: Color(0xFFF0F2F5),
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFF52C41A)),
),
),
const SizedBox(height: 8),
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("H2 Level", style: TextStyle(fontSize: 11, color: Colors.grey)),
Text(
"75%",
style: TextStyle(
fontSize: 11,
color: Color(0xFF52C41A),
fontWeight: FontWeight.bold,
),
),
],
),
],
);
@@ -330,7 +340,7 @@ class CarInfoPage extends GetView<CarInfoController> {
const Divider(),
_buildCertificateRow(
icon: Icons.article_rounded,
title: '运证',
title: '',
attachments: controller.operationAttachments,
),
const Divider(),
@@ -368,7 +378,6 @@ class CarInfoPage extends GetView<CarInfoController> {
title,
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
),
// 使用 Obx 响应式地显示附件数量
subtitle: Obx(
() => Text(
'${attachments.length} 个附件',
@@ -383,7 +392,6 @@ class CarInfoPage extends GetView<CarInfoController> {
),
child: const Icon(Icons.find_in_page_outlined, color: AppTheme.themeColor),
),
// 更新 onTap 逻辑
onTap: () => controller.navigateToCertificateViewer(title, attachments),
);
}
@@ -393,7 +401,7 @@ class CarInfoPage extends GetView<CarInfoController> {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color.fromRGBO(242, 249, 248, 1), // 极浅绿色背景
color: const Color.fromRGBO(242, 249, 248, 1),
borderRadius: BorderRadius.circular(16),
),
child: Column(
@@ -401,69 +409,30 @@ class CarInfoPage extends GetView<CarInfoController> {
children: [
Row(
children: [
Icon(Icons.info_outline, color: Colors.green[700], size: 24),
Icon(Icons.info_outline, color: AppTheme.themeColor, size: 24),
const SizedBox(width: 8),
Text(
"安全提醒",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.green[900],
color: Color.fromRGBO(1, 113, 55, 1),
),
),
],
),
const SizedBox(height: 12),
Text(
const Text(
"请确保车辆证件齐全有效,定期检查车辆状态和证件有效期,以确保运输作业合规安全。",
style: TextStyle(fontSize: 13, color: Colors.green[800], height: 1.5),
style: TextStyle(fontSize: 13, color: Color.fromRGBO(1, 113, 55, 0.8), height: 1.5),
),
const SizedBox(height: 8),
Text(
const Text(
"如有疑问请联系客服400-021-1773",
style: TextStyle(fontSize: 13, color: Colors.green[800]),
),
Row(
children: [
Expanded(
child: FutureBuilder<String>(
future: getVersion(),
builder: (context, snapshot) {
// 判断是否还在加载
if (snapshot.connectionState == ConnectionState.waiting) {
return const Text("");
}
// 如果加载完成且有数据
if (snapshot.hasData) {
return TextX.labelSmall(
"当前版本: ${snapshot.data}",
color: Colors.green[800],
);
}
// 错误处理
return const Text("");
},
),
),
],
style: TextStyle(fontSize: 13, color: Color.fromRGBO(1, 113, 55, 0.8)),
),
],
),
);
}
// 提示信息卡片中的列表项
Widget _buildTipItem(IconData icon, String text) {
return Row(
children: [
Icon(icon, color: Colors.blue, size: 20),
const SizedBox(width: 10),
Expanded(
child: Text(text, style: const TextStyle(fontSize: 12, color: Colors.black54)),
),
],
);
}
}