feat: 多码凑箱已完成装箱时支持跳转箱号查看 & 统一按键识别
- 多码凑箱模式下,扫描已完成装箱的总排号时显示可点击警告横幅, 点击或按P4键可跳转到该总排号所在箱号查看装箱信息 - 统一所有页面按键处理为 LogicalKeyboardKey 命名常量形式, 移除 _androidKeyCodeFromLogicalKey 回退路径 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,8 +20,6 @@ class RegistrationPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RegistrationPageState extends State<RegistrationPage> {
|
||||
static const _androidKeyCodeButtonR1 = 103;
|
||||
|
||||
final _scannerService = ScannerService();
|
||||
final _apiService = ApiService();
|
||||
final _feedbackService = FeedbackService();
|
||||
@@ -101,17 +99,7 @@ class _RegistrationPageState extends State<RegistrationPage> {
|
||||
bool _isLockToggleKey(KeyEvent event) {
|
||||
final key = event.logicalKey;
|
||||
return key == LogicalKeyboardKey.select ||
|
||||
key == LogicalKeyboardKey.gameButtonRight1 ||
|
||||
_androidKeyCodeFromLogicalKey(key) == _androidKeyCodeButtonR1;
|
||||
}
|
||||
|
||||
int? _androidKeyCodeFromLogicalKey(LogicalKeyboardKey key) {
|
||||
final keyId = key.keyId;
|
||||
const androidPlane = LogicalKeyboardKey.androidPlane;
|
||||
if (keyId >= androidPlane && keyId < androidPlane + 0x100000000) {
|
||||
return keyId - androidPlane;
|
||||
}
|
||||
return null;
|
||||
key == LogicalKeyboardKey.gameButtonRight1;
|
||||
}
|
||||
|
||||
void _onScan(ScanResult result) {
|
||||
@@ -676,13 +664,9 @@ class _RegistrationPageState extends State<RegistrationPage> {
|
||||
focusNode: dialogFocus,
|
||||
onKeyEvent: (event) {
|
||||
if (event is! KeyDownEvent) return;
|
||||
final androidKey =
|
||||
_androidKeyCodeFromLogicalKey(event.logicalKey);
|
||||
if (event.logicalKey == LogicalKeyboardKey.arrowUp ||
|
||||
androidKey == 19) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.arrowUp) {
|
||||
setDialogState(() => selectedIndex = 0);
|
||||
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown ||
|
||||
androidKey == 20) {
|
||||
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
||||
setDialogState(() => selectedIndex = 1);
|
||||
} else if (event.logicalKey == LogicalKeyboardKey.enter) {
|
||||
selectedIndex == 0 ? dismissAsNo() : confirmSwitch();
|
||||
|
||||
Reference in New Issue
Block a user