车辆样式调整
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:getx_scaffold/getx_scaffold.dart';
|
import 'package:getx_scaffold/getx_scaffold.dart';
|
||||||
import 'package:ln_jq_app/common/login_util.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/c_page/message/view.dart';
|
||||||
import 'package:ln_jq_app/pages/qr_code/view.dart';
|
|
||||||
import 'package:ln_jq_app/storage_service.dart';
|
import 'package:ln_jq_app/storage_service.dart';
|
||||||
|
|
||||||
|
import '../../../common/styles/theme.dart';
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
class CarInfoPage extends GetView<CarInfoController> {
|
class CarInfoPage extends GetView<CarInfoController> {
|
||||||
@@ -29,7 +29,7 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
_buildCarBindingCard(),
|
_buildCarInfoCard(),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
_buildCertificatesCard(),
|
_buildCertificatesCard(),
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
@@ -216,99 +216,109 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 司机信息卡片中的小统计项
|
/// 构建车辆信息卡片
|
||||||
Widget _buildStatItem(String value, String label) {
|
Widget _buildCarInfoCard() {
|
||||||
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() {
|
|
||||||
return Card(
|
return Card(
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
color: Colors.white,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 18,top: 16),
|
padding: const EdgeInsets.all(20.0),
|
||||||
child: Row(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
_buildDetailRow('车牌号', controller.plateNumber, isPlate: true),
|
||||||
child: Column(
|
const SizedBox(height: 12),
|
||||||
children: [
|
_buildDetailRow('车架号', controller.vin),
|
||||||
_buildInfoRow('车牌号: ${controller.plateNumber}', '扫码绑定'),
|
const SizedBox(height: 12),
|
||||||
const SizedBox(height: 12),
|
_buildDetailRow('车辆型号', controller.modelName),
|
||||||
_buildInfoRow('车架号:', '${controller.vin}'),
|
const SizedBox(height: 12),
|
||||||
const SizedBox(height: 12),
|
_buildDetailRow('车辆品牌', controller.brandName),
|
||||||
_buildInfoRow('车辆型号:', '${controller.modelName}'),
|
const SizedBox(height: 24),
|
||||||
const SizedBox(height: 12),
|
_buildH2LevelProgress(),
|
||||||
_buildInfoRow('车辆品牌:', '${controller.brandName}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Icon(Icons.propane_rounded, size: 50, color: Colors.blue.withOpacity(0.5)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 车辆绑定卡片中的信息行
|
/// 详情行:左右分布
|
||||||
Widget _buildInfoRow(String label, String value) {
|
Widget _buildDetailRow(String label, String value, {bool isPlate = false}) {
|
||||||
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: 13, color: Colors.grey)),
|
||||||
const SizedBox(width: 8),
|
Row(
|
||||||
isButton
|
mainAxisSize: MainAxisSize.min,
|
||||||
? GestureDetector(
|
children: [
|
||||||
onTap: () async {
|
if (isPlate)
|
||||||
controller.doQrCode();
|
GestureDetector(
|
||||||
},
|
onTap: () => controller.doQrCode(),
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsetsGeometry.only(left: 10.w),
|
margin: const EdgeInsets.only(right: 10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Colors.blue.shade300, width: 1),
|
border: Border.all(color: Color.fromRGBO(71, 174, 208, 1)), // 浅绿色边框
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(12),
|
||||||
color: Colors.blue.withOpacity(0.05),
|
color: Color.fromRGBO(235, 250, 255, 1), // 极浅绿色背景
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min, // Keep the row compact
|
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(Icons.sync, size: 12, color: Color.fromRGBO(71, 174, 208, 1)),
|
||||||
StorageService.to.hasVehicleInfo ? Icons.repeat : Icons.search,
|
SizedBox(width: 4),
|
||||||
size: 13,
|
|
||||||
color: Colors.blue,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 3),
|
|
||||||
Text(
|
Text(
|
||||||
StorageService.to.hasVehicleInfo ? "换车牌" : value,
|
StorageService.to.hasVehicleInfo ? "换车牌" : "扫码绑定",
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.blue,
|
color: Color.fromRGBO(71, 174, 208, 1),
|
||||||
fontSize: 11,
|
fontSize: 10,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
|
||||||
: Text(
|
|
||||||
value,
|
|
||||||
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500),
|
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
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(),
|
const Divider(),
|
||||||
_buildCertificateRow(
|
_buildCertificateRow(
|
||||||
icon: Icons.article_rounded,
|
icon: Icons.article_rounded,
|
||||||
title: '营运证',
|
title: '运营证',
|
||||||
attachments: controller.operationAttachments,
|
attachments: controller.operationAttachments,
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
@@ -368,7 +378,6 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
title,
|
title,
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||||
),
|
),
|
||||||
// 使用 Obx 响应式地显示附件数量
|
|
||||||
subtitle: Obx(
|
subtitle: Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'共 ${attachments.length} 个附件',
|
'共 ${attachments.length} 个附件',
|
||||||
@@ -383,7 +392,6 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
),
|
),
|
||||||
child: const Icon(Icons.find_in_page_outlined, color: AppTheme.themeColor),
|
child: const Icon(Icons.find_in_page_outlined, color: AppTheme.themeColor),
|
||||||
),
|
),
|
||||||
// 更新 onTap 逻辑
|
|
||||||
onTap: () => controller.navigateToCertificateViewer(title, attachments),
|
onTap: () => controller.navigateToCertificateViewer(title, attachments),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -393,7 +401,7 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color.fromRGBO(242, 249, 248, 1), // 极浅绿色背景
|
color: const Color.fromRGBO(242, 249, 248, 1),
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -401,69 +409,30 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.info_outline, color: Colors.green[700], size: 24),
|
Icon(Icons.info_outline, color: AppTheme.themeColor, size: 24),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
"安全提醒",
|
"安全提醒",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
color: Colors.green[900],
|
color: Color.fromRGBO(1, 113, 55, 1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
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),
|
const SizedBox(height: 8),
|
||||||
Text(
|
const Text(
|
||||||
"如有疑问请联系客服:400-021-1773",
|
"如有疑问请联系客服:400-021-1773",
|
||||||
style: TextStyle(fontSize: 13, color: Colors.green[800]),
|
style: TextStyle(fontSize: 13, color: Color.fromRGBO(1, 113, 55, 0.8)),
|
||||||
),
|
|
||||||
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("");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提示信息卡片中的列表项
|
|
||||||
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)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user