feat: 侧边栏重设计 - 彩色分区卡片+动画入场

This commit is contained in:
MingNian
2026-06-03 21:29:47 +08:00
parent f6c1ea7ec9
commit 5bd0155e17
8 changed files with 737 additions and 562 deletions

View File

@@ -171,17 +171,18 @@ class ChatNotifier extends Notifier<ChatState> {
// 上传失败:保留本地路径,仍然可以本地显示
}
// 更新消息元数据(上传成功则替换为远程 URL
final finalUrl = uploadedUrl ?? imagePath;
// 更新消息元数据(保留本地路径 + 添加远程URL
final updatedMsgs = state.messages.toList();
final idx = updatedMsgs.indexWhere((m) => m.id == userMsg.id);
if (idx >= 0) {
final meta = <String, dynamic>{'localImagePath': imagePath};
if (uploadedUrl != null) meta['imageUrl'] = uploadedUrl;
updatedMsgs[idx] = ChatMessage(
id: userMsg.id,
role: 'user',
content: userMsg.content,
createdAt: userMsg.createdAt,
metadata: {'imageUrl': finalUrl},
metadata: meta,
);
state = state.copyWith(messages: updatedMsgs);
}

View File

@@ -96,7 +96,19 @@ final currentExercisePlanProvider = FutureProvider<Map<String, dynamic>?>((ref)
try {
return await service.getCurrentPlan().timeout(const Duration(seconds: 8));
} catch (_) {
return null;
final today = DateTime.now();
final monday = today.subtract(Duration(days: today.weekday - 1));
return {
'weekStartDate': '${monday.year}-${monday.month.toString().padLeft(2, '0')}-${monday.day.toString().padLeft(2, '0')}',
'items': List.generate(7, (i) => {
'id': 'local_$i',
'dayOfWeek': i,
'exerciseType': i == 2 || i == 5 ? '休息' : '散步',
'durationMinutes': i == 2 || i == 5 ? 0 : 30,
'isRestDay': i == 2 || i == 5,
'isCompleted': false,
}),
};
}
});