feat: 饮食记录逻辑重构 + 通知管理分隔线修复 + 多页面 UI 调整
- 饮食: 新增 DietCommentaryPolicy + diet_record_logic, 饮食记录逻辑抽取复用 - 通知管理: 分隔线改为仿通知中心样式, 跳过图标区域只留文字下方 - 侧边栏: 对话记录操作栏浮层修复 + 常用功能间距收紧 - 智能体: 欢迎卡片去 400ms 延迟 + 胶囊去阴影 - 后端: AI 会话仓库新增方法 + 饮食评论策略 + 健康记录规则调整 - 其他: api_client IP 适配 + 多页面 UI 微调 + 新增测试
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/app_colors.dart';
|
||||
import '../../core/app_module_visuals.dart';
|
||||
import '../../core/app_theme.dart';
|
||||
import '../../core/navigation_provider.dart';
|
||||
import '../../providers/auth_provider.dart';
|
||||
@@ -21,8 +22,7 @@ class MedicationCheckInPage extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _MedicationCheckInPageState extends ConsumerState<MedicationCheckInPage> {
|
||||
static const _medBlue = Color(0xFF60A5FA);
|
||||
static const _medViolet = Color(0xFF8B5CF6);
|
||||
static const _visual = AppModuleVisuals.medication;
|
||||
static const _softGreen = Color(0xFFEAF8EF);
|
||||
|
||||
Future<List<Map<String, dynamic>>>? _future;
|
||||
@@ -67,11 +67,7 @@ class _MedicationCheckInPageState extends ConsumerState<MedicationCheckInPage> {
|
||||
} catch (e) {
|
||||
debugPrint('[MedCheckIn] 打卡失败: $e');
|
||||
if (mounted) {
|
||||
AppToast.show(
|
||||
context,
|
||||
'打卡失败,请稍后重试',
|
||||
type: AppToastType.error,
|
||||
);
|
||||
AppToast.show(context, '打卡失败,请稍后重试', type: AppToastType.error);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) setState(() => _busyDoses.remove(doseKey));
|
||||
@@ -212,14 +208,7 @@ class _CheckInSummary extends StatelessWidget {
|
||||
width: 42,
|
||||
height: 42,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
_MedicationCheckInPageState._medBlue,
|
||||
_MedicationCheckInPageState._medViolet,
|
||||
],
|
||||
),
|
||||
gradient: _MedicationCheckInPageState._visual.gradient,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: const Icon(
|
||||
@@ -254,10 +243,10 @@ class _CheckInSummary extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
'${(progress * 100).round()}%',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: _MedicationCheckInPageState._medViolet,
|
||||
color: _MedicationCheckInPageState._visual.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -269,8 +258,8 @@ class _CheckInSummary extends StatelessWidget {
|
||||
minHeight: 9,
|
||||
value: progress,
|
||||
backgroundColor: AppColors.cardInner,
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(
|
||||
_MedicationCheckInPageState._medBlue,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
_MedicationCheckInPageState._visual.color,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -300,7 +289,7 @@ class _CheckInSummary extends StatelessWidget {
|
||||
label: '总次数',
|
||||
value: '$total',
|
||||
icon: Icons.format_list_numbered_outlined,
|
||||
color: _MedicationCheckInPageState._medViolet,
|
||||
color: _MedicationCheckInPageState._visual.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -415,7 +404,7 @@ class _MedicationDoseCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: allTaken
|
||||
? _MedicationCheckInPageState._softGreen
|
||||
: AppColors.infoLight,
|
||||
: _MedicationCheckInPageState._visual.lightColor,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: AppColors.borderLight),
|
||||
),
|
||||
@@ -423,7 +412,7 @@ class _MedicationDoseCard extends StatelessWidget {
|
||||
allTaken ? Icons.done_all_rounded : Icons.medication_liquid,
|
||||
color: allTaken
|
||||
? AppTheme.success
|
||||
: _MedicationCheckInPageState._medBlue,
|
||||
: _MedicationCheckInPageState._visual.color,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
@@ -613,7 +602,7 @@ class _DoseRow extends StatelessWidget {
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: isTaken
|
||||
? Colors.white
|
||||
: _MedicationCheckInPageState._medBlue,
|
||||
: _MedicationCheckInPageState._visual.color,
|
||||
foregroundColor: isTaken
|
||||
? AppTheme.success
|
||||
: Colors.white,
|
||||
|
||||
Reference in New Issue
Block a user