feat: UI全面改造 + 后端多项修复
【后端修复】 - 删除diet/consultation agent假工具声明 - 修复DayOfWeek实体注释 - 修复Vision API content序列化 - cleanup_service级联删除修复 - 用药提醒时区偏差修复 - 统一DateTime处理(UtcNow+8) - 新增UTC DateTime JSON转换器 【前端UI重构】 - 配色体系全面更新(#8B5CF6淡紫+#F0ECFF背景) - 登录页重设计 - 首页重设计(透明顶栏、渐变背景、胶囊输入区) - 聊天卡片加白蓝边框、渐变标题 - 侧边栏重构(渐变背景、合并顶部、删除底部设置) - 确认卡片可编辑字段恢复 - 所有子页面加返回按钮 - catch异常加日志 - 删除后refresh provider缓存
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../core/app_colors.dart';
|
||||
import '../../core/app_theme.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../core/navigation_provider.dart';
|
||||
@@ -74,8 +75,8 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
Widget _buildHeader(ReportAnalysis analysis) {
|
||||
return Container(
|
||||
width: double.infinity, padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [BoxShadow(color: AppTheme.primary.withAlpha(10), blurRadius: 8)]),
|
||||
decoration: BoxDecoration(color: AppTheme.surface, borderRadius: BorderRadius.circular(AppTheme.rLg),
|
||||
boxShadow: [AppTheme.shadowCard]),
|
||||
child: Row(children: [
|
||||
Container(width: 48, height: 48, decoration: BoxDecoration(color: AppTheme.primaryLight, borderRadius: BorderRadius.circular(12)),
|
||||
child: const Icon(Icons.auto_awesome, size: 28, color: AppTheme.primary)),
|
||||
@@ -83,7 +84,7 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(analysis.reportType, style: const TextStyle(fontSize: 21, fontWeight: FontWeight.w700)),
|
||||
const SizedBox(height: 4),
|
||||
const Text('AI 预解读结果 · 待医生确认', style: TextStyle(fontSize: 16, color: Color(0xFF999999))),
|
||||
const Text('AI 预解读结果 · 待医生确认', style: TextStyle(fontSize: 16, color: AppColors.textSecondary)),
|
||||
])),
|
||||
]),
|
||||
);
|
||||
@@ -94,16 +95,16 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
return Container(
|
||||
width: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: isReviewed ? const Color(0xFFDCFCE7) : const Color(0xFFFFF3E0),
|
||||
color: isReviewed ? AppColors.successLight : AppColors.warningLight,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||
Icon(isReviewed ? Icons.check_circle : Icons.hourglass_empty, size: 21,
|
||||
color: isReviewed ? AppTheme.success : const Color(0xFFF59E0B)),
|
||||
color: isReviewed ? AppTheme.success : AppColors.warning),
|
||||
const SizedBox(width: 8),
|
||||
Text(isReviewed ? '已通过医生审核' : '等待医生审核中',
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500,
|
||||
color: isReviewed ? AppTheme.success : const Color(0xFFF59E0B))),
|
||||
color: isReviewed ? AppTheme.success : AppColors.warning)),
|
||||
]),
|
||||
);
|
||||
}
|
||||
@@ -111,7 +112,7 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
Widget _buildIndicators(ReportAnalysis analysis) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(16)),
|
||||
decoration: BoxDecoration(color: AppTheme.surface, borderRadius: BorderRadius.circular(AppTheme.rLg)),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, 16, 16, 8),
|
||||
@@ -128,19 +129,19 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
final IconData icon;
|
||||
switch (ind.status) {
|
||||
case 'high': color = AppTheme.error; icon = Icons.arrow_upward; break;
|
||||
case 'low': color = const Color(0xFFF9A825); icon = Icons.arrow_downward; break;
|
||||
case 'low': color = AppColors.warning; icon = Icons.arrow_downward; break;
|
||||
default: color = AppTheme.success; icon = Icons.check_circle;
|
||||
}
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: const BoxDecoration(border: Border(bottom: BorderSide(color: Color(0xFFF0F0F0)))),
|
||||
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: AppColors.border))),
|
||||
child: Row(children: [
|
||||
Expanded(
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(ind.name, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w500)),
|
||||
if (ind.referenceRange != null && ind.referenceRange!.isNotEmpty)
|
||||
Text('参考值: ${ind.referenceRange}', style: const TextStyle(fontSize: 15, color: Color(0xFF999999))),
|
||||
Text('参考值: ${ind.referenceRange}', style: TextStyle(fontSize: 15, color: AppColors.textHint)),
|
||||
]),
|
||||
),
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
|
||||
@@ -155,23 +156,23 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
Widget _buildSummary(ReportAnalysis analysis) {
|
||||
return Container(
|
||||
width: double.infinity, padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: const Color(0xFFFEFCE8), borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFFFDE68A))),
|
||||
decoration: BoxDecoration(color: AppColors.warningLight, borderRadius: BorderRadius.circular(AppTheme.rLg),
|
||||
border: Border.all(color: AppColors.warning.withAlpha(80))),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
const Row(children: [
|
||||
Text('💡', style: TextStyle(fontSize: 21)),
|
||||
SizedBox(width: 8),
|
||||
Text('综合解读', style: TextStyle(fontSize: 19, fontWeight: FontWeight.w700, color: Color(0xFFD97706))),
|
||||
Row(children: [
|
||||
const Text('💡', style: TextStyle(fontSize: 21)),
|
||||
const SizedBox(width: 8),
|
||||
Text('综合解读', style: TextStyle(fontSize: 19, fontWeight: FontWeight.w700, color: AppColors.warning)),
|
||||
]),
|
||||
const SizedBox(height: 10),
|
||||
Text(analysis.summary.isNotEmpty ? analysis.summary : '暂无 AI 解读结果',
|
||||
style: const TextStyle(fontSize: 17, color: Color(0xFF92400E), height: 1.6)),
|
||||
style: TextStyle(fontSize: 17, color: AppColors.warning, height: 1.6)),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
width: double.infinity, padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)),
|
||||
child: const Text('⚠️ AI 解读仅供参考,请以医生诊断为准',
|
||||
style: TextStyle(fontSize: 15, color: Color(0xFFD97706))),
|
||||
decoration: BoxDecoration(color: AppTheme.surface, borderRadius: BorderRadius.circular(AppTheme.rSm)),
|
||||
child: Text('⚠️ AI 解读仅供参考,请以医生诊断为准',
|
||||
style: TextStyle(fontSize: 15, color: AppColors.warning)),
|
||||
),
|
||||
]),
|
||||
);
|
||||
@@ -180,22 +181,22 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
Widget _buildDoctorReview(ReportItem report) {
|
||||
return Container(
|
||||
width: double.infinity, padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(color: const Color(0xFFDCFCE7), borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: const Color(0xFF86EFAC))),
|
||||
decoration: BoxDecoration(color: AppColors.successLight, borderRadius: BorderRadius.circular(AppTheme.rLg),
|
||||
border: Border.all(color: AppColors.success.withAlpha(80))),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
const Row(children: [
|
||||
Text('✅', style: TextStyle(fontSize: 21)),
|
||||
SizedBox(width: 8),
|
||||
Text('医生审核意见', style: TextStyle(fontSize: 19, fontWeight: FontWeight.w700, color: Color(0xFF2E7D32))),
|
||||
Row(children: [
|
||||
const Text('✅', style: TextStyle(fontSize: 21)),
|
||||
const SizedBox(width: 8),
|
||||
Text('医生审核意见', style: TextStyle(fontSize: 19, fontWeight: FontWeight.w700, color: AppColors.success)),
|
||||
]),
|
||||
if (report.doctorName != null) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text('审核医生:${report.doctorName}', style: const TextStyle(fontSize: 16, color: Color(0xFF4CAF50))),
|
||||
Text('审核医生:${report.doctorName}', style: TextStyle(fontSize: 16, color: AppColors.success)),
|
||||
],
|
||||
if (report.reviewedAt != null) ...[
|
||||
const SizedBox(height: 2),
|
||||
Text('审核时间:${report.reviewedAt!.toLocal().toString().substring(0, 16)}',
|
||||
style: const TextStyle(fontSize: 15, color: Color(0xFF81C784))),
|
||||
style: TextStyle(fontSize: 15, color: AppColors.success.withAlpha(180))),
|
||||
],
|
||||
if (report.severity != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
@@ -205,18 +206,18 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
width: double.infinity, padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)),
|
||||
decoration: BoxDecoration(color: AppTheme.surface, borderRadius: BorderRadius.circular(AppTheme.rSm)),
|
||||
child: Text('💬 ${report.doctorComment!}',
|
||||
style: const TextStyle(fontSize: 18, color: Color(0xFF1A1A1A), height: 1.5)),
|
||||
style: TextStyle(fontSize: 18, color: AppColors.textPrimary, height: 1.5)),
|
||||
),
|
||||
],
|
||||
if (report.doctorRecommendation != null && report.doctorRecommendation!.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
width: double.infinity, padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)),
|
||||
decoration: BoxDecoration(color: AppTheme.surface, borderRadius: BorderRadius.circular(AppTheme.rSm)),
|
||||
child: Text('📝 ${report.doctorRecommendation!}',
|
||||
style: const TextStyle(fontSize: 17, color: Color(0xFF333333), height: 1.5)),
|
||||
style: TextStyle(fontSize: 17, color: AppColors.textPrimary, height: 1.5)),
|
||||
),
|
||||
],
|
||||
]),
|
||||
@@ -225,11 +226,11 @@ class _AiAnalysisPageState extends ConsumerState<AiAnalysisPage> {
|
||||
|
||||
Widget _severityBadge(String severity) {
|
||||
final (label, color, bg) = switch (severity) {
|
||||
'Normal' => ('🟢 正常', AppTheme.success, const Color(0xFFDCFCE7)),
|
||||
'Abnormal' => ('🟡 轻度异常', const Color(0xFFF59E0B), const Color(0xFFFFF3E0)),
|
||||
'Severe' => ('🟠 中度异常', const Color(0xFFFF7043), const Color(0xFFFEE2E2)),
|
||||
'Critical' => ('🔴 重度异常', const Color(0xFFDC2626), const Color(0xFFFEE2E2)),
|
||||
_ => (severity, Colors.grey, Colors.grey.withAlpha(30)),
|
||||
'Normal' => ('🟢 正常', AppTheme.success, AppColors.successLight),
|
||||
'Abnormal' => ('🟡 轻度异常', AppColors.warning, AppColors.warningLight),
|
||||
'Severe' => ('🟠 中度异常', AppColors.error, AppColors.errorLight),
|
||||
'Critical' => ('🔴 重度异常', AppColors.error, AppColors.errorLight),
|
||||
_ => (severity, AppColors.textHint, AppColors.borderLight),
|
||||
};
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
|
||||
Reference in New Issue
Block a user