Files
arc/.planning/quick/260330-ll6-fix-registration/260330-ll6-SUMMARY.md
leon 1c4f01904e fix(example): 修复注册后不显示已注册状态的问题
问题:注册按钮只更新了显示列表,没有将特征标识和ID存入映射表
修复:
- 添加 _currentFaceKeys 保存当前帧的人脸特征标识
- 注册时将特征标识和生成的ID存入 _faceIdMap
- 下次检测时可以从映射表中找到已注册的ID

Quick task: 260330-ll6
2026-03-30 15:35:42 +08:00

36 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Quick Task 260330-ll6: Summary
## Task
注册完成后并不会显示用户已注册,检查一下注册流程和检测流程。
## Problem Analysis
**问题根源**
1. 检测时,`_getFaceKey()` 生成人脸特征标识
2. 注册按钮只更新了 `_currentFaceIds` 列表,但**没有将特征标识和ID存入 `_faceIdMap`**
3. 下次检测时,`_faceIdMap` 为空,所有人脸都显示"未注册"
## Fix
### `example/lib/main.dart`
1. **添加状态变量**: `_currentFaceKeys` - 保存当前帧的人脸特征标识列表
2. **修改检测流程**: 同时保存特征标识和ID
3. **修改注册流程**: 注册时将特征标识和生成的ID存入 `_faceIdMap`
## Code Changes
```dart
// 新增: 保存当前帧的人脸特征标识
List<String> _currentFaceKeys = [];
// 检测时: 同时保存特征标识
_currentFaceKeys = faceList.map((face) => _getFaceKey(face)).toList();
_currentFaceIds = _currentFaceKeys.map((key) => _faceIdMap[key] ?? '未注册').toList();
// 注册时: 将特征标识和ID存入映射表
_faceIdMap[faceKey] = newId;
```
## Verification
- `flutter analyze lib/main.dart` - No issues found
---
*Completed: 2026-03-30*