feat:查询菜单页面适配小键盘

This commit is contained in:
dzc committed 2026-09-20 13:20:50 +08:00
1 parent 8e9bcba3c3
commit f9be6dea13
10 files changed
+922 -182

No files matched your search

+18 -3
View File
@@ -82,6 +82,11 @@ abstract class AppSettingTool {
static const String _menuQueryShortcutKeyBindingsKey =
"menuQueryShortcutKeyBindings";
/// 查询菜单快捷小键盘模式开关在现有 sysJson 中的稳定存储键;
/// 缺失时按开启处理(配合出厂默认键位开箱即用),仅明确保存 false 才关闭。
static const String _reservationQueryKeyboardModeEnabledKey =
"reservationQueryKeyboardModeEnabled";
/// 早餐、中餐和晚餐的本地时间范围;值使用现有 ProductHourType 后端编码。
static const String _productMealPeriodsKey = "productMealPeriods";
static const String _serialCardConfigKey = "serialCardConfig";
@@ -634,9 +639,14 @@ abstract class AppSettingTool {
)
.firstOrNull ??
ReservationMealSlot.morning;
final shortcutKeyBindings = _parseMenuQueryShortcutKeyBindings(
sysJson[_menuQueryShortcutKeyBindingsKey],
);
// 终端从未保存过快捷按键配置(全新安装或旧版本升级)时使用出厂默认字母按键;
// 键一旦存在就完全以用户配置为准,即使值为空对象(用户已主动清空全部绑定)。
final shortcutKeyBindings =
sysJson.containsKey(_menuQueryShortcutKeyBindingsKey)
? _parseMenuQueryShortcutKeyBindings(
sysJson[_menuQueryShortcutKeyBindingsKey],
)
: MenuQueryShortcutKeyBinding.defaults;
return ReservationQueryPagePreferences(
methodOrder: List.unmodifiable(restored),
defaultMethod: defaultMethod,
@@ -658,6 +668,9 @@ abstract class AppSettingTool {
selectedMealSlot: selectedMealSlot,
verificationDateScope: verificationDateScope,
shortcutKeyBindings: shortcutKeyBindings,
// 键盘模式默认开启:仅操作员明确保存过关闭状态才保持关闭。
keyboardModeEnabled:
sysJson[_reservationQueryKeyboardModeEnabledKey] != false,
);
}
@@ -706,6 +719,7 @@ abstract class AppSettingTool {
required ReservationVerificationDateScope verificationDateScope,
required Map<MenuQueryShortcutAction, MenuQueryShortcutKeyBinding>
shortcutKeyBindings,
required bool keyboardModeEnabled,
}) {
final normalized = <ReservationRecognitionMethod>[];
for (final method in order) {
@@ -738,6 +752,7 @@ abstract class AppSettingTool {
if (entry.value.usbHidUsage != 0 || entry.value.logicalKeyId != 0)
entry.key.code: entry.value.toJson(),
};
sysJson[_reservationQueryKeyboardModeEnabledKey] = keyboardModeEnabled;
});
}