feat: support box-number navigation for completed multi-code boxing & unify key handling

- In multi-code boxing mode, scanning a completed total-row number shows a
  clickable warning banner; clicking it or pressing P4 navigates to that
  box number to view boxing details.
- Unify key handling across all pages to LogicalKeyboardKey named constants,
  removing the _androidKeyCodeFromLogicalKey fallback path.

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 f587194267
commit b1a76287d6
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;
}