This commit is contained in:
2026-01-23 09:22:07 +08:00
parent cf3ad579d3
commit 5236670e7c
3 changed files with 243 additions and 72 deletions

View File

@@ -22,11 +22,33 @@ class CarInfoController extends GetxController with BaseControllerMixin {
final RxList<String> operationAttachments = <String>[].obs; final RxList<String> operationAttachments = <String>[].obs;
final RxList<String> hydrogenationAttachments = <String>[].obs; final RxList<String> hydrogenationAttachments = <String>[].obs;
final RxList<String> registerAttachments = <String>[].obs; final RxList<String> registerAttachments = <String>[].obs;
bool isNotice = false;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
getUserBindCarInfo(); getUserBindCarInfo();
_msgNotice();
}
Future<void> _msgNotice() async {
final Map<String, dynamic> requestData = {
'appFlag': 1,
'isRead': 1,
'pageNum': 1,
'pageSize': 5,
};
final response = await HttpService.to.get(
'appointment/unread_notice/page',
params: requestData,
);
if (response != null) {
final result = BaseModel.fromJson(response.data);
if (result.code == 0 && result.data != null) {
String total = result.data["total"].toString();
isNotice = int.parse(total) > 0;
}
}
} }
@override @override

View File

@@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.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/styles/theme.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/pages/qr_code/view.dart';
import 'package:ln_jq_app/storage_service.dart'; import 'package:ln_jq_app/storage_service.dart';
@@ -16,22 +18,26 @@ class CarInfoPage extends GetView<CarInfoController> {
id: 'car_info', id: 'car_info',
builder: (_) { builder: (_) {
return Scaffold( return Scaffold(
backgroundColor: Colors.grey[100], backgroundColor: Color.fromRGBO(240, 244, 247, 0.4),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Padding( child: Column(
padding: const EdgeInsets.all(12.0), children: [
child: Column( _buildUserInfoCard(),
crossAxisAlignment: CrossAxisAlignment.stretch, Padding(
children: [ padding: const EdgeInsets.all(12.0),
_buildDriverInfoCard(), child: Column(
const SizedBox(height: 5), crossAxisAlignment: CrossAxisAlignment.stretch,
_buildCarBindingCard(), children: [
const SizedBox(height: 5), const SizedBox(height: 5),
_buildCertificatesCard(), _buildCarBindingCard(),
const SizedBox(height: 5), const SizedBox(height: 5),
_buildTipsCard(), _buildCertificatesCard(),
], const SizedBox(height: 5),
), _buildSafetyReminderCard(),
],
),
),
],
), ),
), ),
); );
@@ -39,74 +45,126 @@ class CarInfoPage extends GetView<CarInfoController> {
); );
} }
/// 构建顶部的司机信息卡片 Widget _buildUserInfoCard() {
Widget _buildDriverInfoCard() {
return Card( return Card(
elevation: 2, elevation: 1,
color: Colors.white,
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
),
),
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 16, top: 40),
// 增加了顶部 padding 适配状态栏
child: Row( child: Row(
children: [ children: [
const CircleAvatar( Stack(
radius: 20, children: [
backgroundColor: Colors.blue, CircleAvatar(
child: Icon(Icons.person, color: Colors.white, size: 34), radius: 25,
backgroundColor: Colors.white,
child: LoginUtil.getAssImg('ic_user_logo@2x'),
),
Positioned(
right: 0,
bottom: 0,
child: SizedBox(
height: 16.h,
width: 16.w,
child: LoginUtil.getAssImg('ic_logo@2x'),
),
),
],
), ),
const SizedBox(width: 12), SizedBox(width: 8.w),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Row(
"${StorageService.to.name}", children: [
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold), Text(
"${StorageService.to.name}",
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
SizedBox(width: 8.w),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 2,
),
decoration: BoxDecoration(
color: const Color.fromRGBO(236, 255, 234, 1), // 极浅绿色背景
border: Border.all(color: const Color(0xFFB7E19F)), // 边框
borderRadius: BorderRadius.circular(12),
),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.eco, size: 12, color: Color(0xFF52C41A)),
// 叶子图标
SizedBox(width: 4),
Text(
"绿色先锋",
style: TextStyle(
color: Color(0xFF52C41A),
fontSize: 10,
),
),
],
),
),
],
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
"${StorageService.to.phone}", "羚牛ID${StorageService.to.phone}",
style: TextStyle(color: Colors.grey, fontSize: 11), style: const TextStyle(color: Colors.grey, fontSize: 11),
), ),
], ],
), ),
), ),
Container( IconButton(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), onPressed: () {
decoration: BoxDecoration( Get.to(() => const MessagePage());
color: Colors.blue[50], },
borderRadius: BorderRadius.circular(12), style: IconButton.styleFrom(
border: Border.all(color: Colors.blue, width: 0.5), backgroundColor: Colors.grey[100],
padding: const EdgeInsets.all(8),
), ),
child: const Row( icon: Badge(
children: [ smallSize: 8,
Icon(Icons.shield_outlined, color: Colors.blue, size: 14), backgroundColor: controller.isNotice
SizedBox(width: 4), ? Colors.red
Text( : Colors.transparent,
'已认证', child: const Icon(
style: TextStyle( Icons.notifications_outlined,
color: Colors.blue, color: Colors.black87,
fontSize: 10, size: 30,
fontWeight: FontWeight.bold, ),
),
),
],
), ),
), ),
], ],
), ),
), ),
const Divider(height: 1, indent: 16, endIndent: 16),
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0), padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
_buildStatItem('156', '服务天数'), _buildModernStatItem('本月里程数', 'Accumulated', '2,852km', ''),
_buildStatItem('4.9', '评分'), const SizedBox(width: 8),
_buildStatItem('98%', '准时率'), _buildModernStatItem('总里程', 'Refuel Count', "2.5W km", ''),
const SizedBox(width: 8),
_buildModernStatItem('服务评分', 'Driver rating', "4.9分", ''),
], ],
), ),
), ),
@@ -115,6 +173,49 @@ class CarInfoPage extends GetView<CarInfoController> {
); );
} }
// 统计项
Widget _buildModernStatItem(String title, String subtitle, String value, String unit) {
return Expanded(
child: Container(
padding: const EdgeInsets.all(12.0),
decoration: BoxDecoration(
color: const Color(0xFFF8F9FA),
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
Text(subtitle, style: const TextStyle(fontSize: 9, color: Colors.grey)),
const SizedBox(height: 8),
Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
value,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.black87,
),
),
Text(unit, style: const TextStyle(fontSize: 10, color: Colors.black54)),
],
),
],
),
),
);
}
// 司机信息卡片中的小统计项 // 司机信息卡片中的小统计项
Widget _buildStatItem(String value, String label) { Widget _buildStatItem(String value, String label) {
return Column( return Column(
@@ -137,9 +238,9 @@ class CarInfoPage extends GetView<CarInfoController> {
Widget _buildCarBindingCard() { Widget _buildCarBindingCard() {
return Card( return Card(
elevation: 2, elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 18,top: 16),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@@ -287,21 +388,68 @@ class CarInfoPage extends GetView<CarInfoController> {
); );
} }
Widget _buildTipsCard() { /// 安全提醒卡片
return Card( Widget _buildSafetyReminderCard() {
elevation: 2, return Container(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), padding: const EdgeInsets.all(16),
child: Padding( decoration: BoxDecoration(
padding: const EdgeInsets.all(16.0), color: const Color.fromRGBO(242, 249, 248, 1), // 极浅绿色背景
child: Column( borderRadius: BorderRadius.circular(16),
children: [ ),
_buildTipItem(Icons.info_outline, '请确保车辆证件齐全有效'), child: Column(
const SizedBox(height: 10), crossAxisAlignment: CrossAxisAlignment.start,
_buildTipItem(Icons.rule, '定期检查车辆状态和证件有效期'), children: [
const SizedBox(height: 10), Row(
_buildTipItem(Icons.headset_mic_outlined, '如有疑问请联系客服: 400-021-1773'), children: [
], Icon(Icons.info_outline, color: Colors.green[700], size: 24),
), const SizedBox(width: 8),
Text(
"安全提醒",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.green[900],
),
),
],
),
const SizedBox(height: 12),
Text(
"请确保车辆证件齐全有效,定期检查车辆状态和证件有效期,以确保运输作业合规安全。",
style: TextStyle(fontSize: 13, color: Colors.green[800], height: 1.5),
),
const SizedBox(height: 8),
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("");
},
),
),
],
),
],
), ),
); );
} }

View File

@@ -38,6 +38,7 @@ class MinePage extends GetView<MineController> {
_buildSafetyReminderCard(), _buildSafetyReminderCard(),
SizedBox(height: 24.h), SizedBox(height: 24.h),
_buildLogoutButton(), _buildLogoutButton(),
SizedBox(height: 24.h),
], ],
), ),
), ),