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:
@@ -110,14 +110,15 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
constraints: BoxConstraints(maxWidth: screenWidth * 0.95),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Color(0xFFE2E8F0), width: 2),
|
||||
boxShadow: AppColors.cardShadow,
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// ── 标题区域(清爽蓝紫渐变背景) ──
|
||||
// ── 标题区域 ──
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.fromLTRB(20, 22, 20, 20),
|
||||
@@ -247,6 +248,15 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
|
||||
// ── 医生选择区(问诊专用)──
|
||||
if (agent == ActiveAgent.consultation) ...[
|
||||
const SizedBox(height: 14),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: _buildDoctorCards(ref),
|
||||
),
|
||||
],
|
||||
|
||||
// ── 快捷操作按钮区 ──
|
||||
if (actions.isNotEmpty) ...[
|
||||
const SizedBox(height: 14),
|
||||
@@ -550,14 +560,15 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
constraints: BoxConstraints(maxWidth: screenWidth * 0.95),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Color(0xFFE2E8F0), width: 2),
|
||||
boxShadow: AppColors.cardShadow,
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// ── 标题区域(清爽蓝紫渐变背景) ──
|
||||
// ── 标题区域 ──
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.fromLTRB(20, 20, 20, 18),
|
||||
@@ -758,10 +769,7 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
msg.confirmed = true;
|
||||
if (isMedication) ref.invalidate(medicationListProvider);
|
||||
if (isHealth) ref.invalidate(latestHealthProvider);
|
||||
ref.read(chatProvider.notifier).markNeedsRebuild();
|
||||
ref.read(chatProvider.notifier).confirmMessage(msg.id);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Row(
|
||||
@@ -816,8 +824,7 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
else
|
||||
InkWell(
|
||||
onTap: () {
|
||||
msg.metadata?['_editingField'] = field.label;
|
||||
ref.read(chatProvider.notifier).markNeedsRebuild();
|
||||
ref.read(chatProvider.notifier).startEditingField(msg.id, field.label);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -854,14 +861,10 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
border: InputBorder.none,
|
||||
),
|
||||
onSubmitted: (value) {
|
||||
msg.metadata?[field.label] = value;
|
||||
msg.metadata?['_editingField'] = null;
|
||||
ref.read(chatProvider.notifier).markNeedsRebuild();
|
||||
ref.read(chatProvider.notifier).finishEditingField(msg.id, field.label, value);
|
||||
},
|
||||
onTapOutside: (_) {
|
||||
msg.metadata?[field.label] = controller.text;
|
||||
msg.metadata?['_editingField'] = null;
|
||||
ref.read(chatProvider.notifier).markNeedsRebuild();
|
||||
ref.read(chatProvider.notifier).finishEditingField(msg.id, field.label, controller.text);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -1057,6 +1060,7 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
.replaceAll(RegExp(r'^[\-\*]\s+', multiLine: true), '')
|
||||
.replaceAll(RegExp(r'`(.+?)`'), r'$1')
|
||||
.replaceAll(RegExp(r'\[([^\]]+)\]\([^)]+\)'), r'$1')
|
||||
.replaceAll('\$1', '') // AI 偶尔输出 $1 占位符
|
||||
.replaceAll(RegExp(r'\n{3,}'), '\n\n')
|
||||
.trim();
|
||||
}
|
||||
@@ -1328,20 +1332,35 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [BoxShadow(color: AppTheme.primary.withAlpha(10), blurRadius: 8, offset: const Offset(0, 2))],
|
||||
border: Border.all(color: Color(0xFFE2E8F0), width: 2),
|
||||
boxShadow: AppColors.cardShadow,
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Row(children: [
|
||||
Icon(Icons.today, size: 21, color: AppTheme.primary),
|
||||
const SizedBox(width: 8),
|
||||
const Text('今日任务', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: AppColors.textPrimary)),
|
||||
]),
|
||||
const SizedBox(height: 10),
|
||||
...tasks,
|
||||
Container(
|
||||
width: double.infinity, padding: const EdgeInsets.fromLTRB(16, 12, 16, 10),
|
||||
decoration: const BoxDecoration(gradient: LinearGradient(colors: [Color(0xFFF0ECFF), Color(0xFFEBF4FF)])),
|
||||
child: Row(children: [
|
||||
Container(width: 28, height: 28, decoration: BoxDecoration(color: Colors.white.withOpacity(0.6), borderRadius: BorderRadius.circular(8)),
|
||||
child: const Icon(Icons.health_and_safety, size: 16, color: AppColors.primary)),
|
||||
const SizedBox(width: 8),
|
||||
const Text('今日健康', style: TextStyle(fontSize: 15, fontWeight: FontWeight.w600, color: AppColors.textPrimary)),
|
||||
const Spacer(),
|
||||
Text('${now.month}月${now.day}日', style: const TextStyle(fontSize: 13, color: AppColors.textSecondary)),
|
||||
]),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
if (tasks.isEmpty)
|
||||
_taskRow(context, Icons.check_circle, '今日暂无待办', status: 'done')
|
||||
else
|
||||
...tasks,
|
||||
]),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user