feat: 多码凑箱已完成装箱时支持跳转箱号查看 & 统一按键识别

- 多码凑箱模式下,扫描已完成装箱的总排号时显示可点击警告横幅,
  点击或按P4键可跳转到该总排号所在箱号查看装箱信息
- 统一所有页面按键处理为 LogicalKeyboardKey 命名常量形式,
  移除 _androidKeyCodeFromLogicalKey 回退路径

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-05-20 14:21:38 +08:00
parent 7d22c23dfe
commit 928e7296b1
3 changed files with 55 additions and 64 deletions

View File

@@ -39,10 +39,6 @@ class HomePage extends StatefulWidget {
}
class _HomePageState extends State<HomePage> {
static const _androidKeyCode1 = 8;
static const _androidKeyCode2 = 9;
static const _androidKeyCode3 = 10;
final _apiService = ApiService();
final _focusNode = FocusNode();
bool _isCheckingConnection = false;
@@ -134,23 +130,6 @@ class _HomePageState extends State<HomePage> {
event.character == '3') {
return 3;
}
// Android keyCode fallback for scanner devices: 1/2/3 => 8/9/10.
final androidKeyCode = _androidKeyCodeFromLogicalKey(key);
return switch (androidKeyCode) {
_androidKeyCode1 => 1,
_androidKeyCode2 => 2,
_androidKeyCode3 => 3,
_ => null,
};
}
int? _androidKeyCodeFromLogicalKey(LogicalKeyboardKey key) {
final keyId = key.keyId;
const androidPlane = LogicalKeyboardKey.androidPlane;
if (keyId >= androidPlane && keyId < androidPlane + 0x100000000) {
return keyId - androidPlane;
}
return null;
}