fix: diet capture flow - 去掉多余页面,点击直接拍照

- 点击"拍照识别/上传照片"直接打开相机/相册,不再跳转多余选择页
- DietCapturePage 去掉重复的拍照按钮,只保留分析结果展示
- 新增 dietActionProvider 处理拍饮食触发
- 修复 initState reset 导致结果页被清空的 bug
- 修复 IP 地址恢复问题
This commit is contained in:
MingNian
2026-06-08 14:39:45 +08:00
parent 287eab80a9
commit 714adc2d51
5 changed files with 40 additions and 69 deletions

View File

@@ -182,6 +182,8 @@ class ChatMessagesView extends ConsumerWidget {
onTap: () {
if (a.label == '服药打卡') {
_medicationCheckIn(ref, context);
} else if (a.action == 'pickFoodCamera' || a.action == 'pickFoodGallery') {
ref.read(dietActionProvider.notifier).trigger(a.action!);
} else if (a.route != null) {
if (a.route == 'camera' || a.route == 'gallery') {
ref.read(cameraActionProvider.notifier).trigger(a.route!);
@@ -1372,8 +1374,8 @@ final _agentActions = <ActiveAgent, List<_AgentAction>>{
_AgentAction(label: '查看趋势', icon: Icons.trending_up, isWide: true, route: 'trend'),
],
ActiveAgent.diet: [
_AgentAction(label: '拍照识别', icon: Icons.camera_alt_outlined, isWide: true, route: 'dietCapture'),
_AgentAction(label: '上传照片', icon: Icons.photo_library_outlined, isWide: true, route: 'dietCapture'),
_AgentAction(label: '拍照识别', icon: Icons.camera_alt_outlined, isWide: true, action: 'pickFoodCamera'),
_AgentAction(label: '上传照片', icon: Icons.photo_library_outlined, isWide: true, action: 'pickFoodGallery'),
],
ActiveAgent.medication: [
_AgentAction(label: '用药管理', icon: Icons.medication_liquid_outlined, isWide: true, route: 'medications'),