feat: 饮食记录逻辑重构 + 通知管理分隔线修复 + 多页面 UI 调整
- 饮食: 新增 DietCommentaryPolicy + diet_record_logic, 饮食记录逻辑抽取复用 - 通知管理: 分隔线改为仿通知中心样式, 跳过图标区域只留文字下方 - 侧边栏: 对话记录操作栏浮层修复 + 常用功能间距收紧 - 智能体: 欢迎卡片去 400ms 延迟 + 胶囊去阴影 - 后端: AI 会话仓库新增方法 + 饮食评论策略 + 健康记录规则调整 - 其他: api_client IP 适配 + 多页面 UI 微调 + 新增测试
This commit is contained in:
12
health_app/test/diet_meal_selection_test.dart
Normal file
12
health_app/test/diet_meal_selection_test.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:health_app/pages/diet/diet_capture_page.dart';
|
||||
|
||||
void main() {
|
||||
test('new diet analysis requires the user to choose a meal type', () {
|
||||
final container = ProviderContainer();
|
||||
addTearDown(container.dispose);
|
||||
|
||||
expect(container.read(dietProvider).mealType, isEmpty);
|
||||
});
|
||||
}
|
||||
18
health_app/test/diet_record_logic_test.dart
Normal file
18
health_app/test/diet_record_logic_test.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:health_app/pages/diet/diet_record_logic.dart';
|
||||
|
||||
void main() {
|
||||
test('recent diet dates end with today', () {
|
||||
final now = DateTime(2026, 7, 12, 21, 30);
|
||||
|
||||
final dates = recentDietDates(now);
|
||||
|
||||
expect(dates, hasLength(7));
|
||||
expect(dates.first, DateTime(2026, 7, 6));
|
||||
expect(dates.last, DateTime(2026, 7, 12));
|
||||
});
|
||||
|
||||
test('blank food draft is not valid for saving', () {
|
||||
expect(isSavableFood(name: '', portion: '', calories: 0), isFalse);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user