Skip to content

Commit

Permalink
Fix QueryHotkeys not been initialized error
Browse files Browse the repository at this point in the history
  • Loading branch information
qianlifeng committed Apr 28, 2024
1 parent 5ce387a commit b6d0d60
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions Wox.UI.Flutter/wox/lib/entity/wox_setting.dart
Expand Up @@ -13,20 +13,21 @@ class WoxSetting {
late int appWidth;
late String themeId;

WoxSetting(
{required this.mainHotkey,
required this.selectionHotkey,
required this.usePinYin,
required this.switchInputMethodABC,
required this.hideOnStart,
required this.hideOnLostFocus,
required this.showTray,
required this.langCode,
required this.queryHotkeys,
required this.queryShortcuts,
required this.lastQueryMode,
required this.appWidth,
required this.themeId});
WoxSetting({
required this.mainHotkey,
required this.selectionHotkey,
required this.usePinYin,
required this.switchInputMethodABC,
required this.hideOnStart,
required this.hideOnLostFocus,
required this.showTray,
required this.langCode,
required this.queryHotkeys,
required this.queryShortcuts,
required this.lastQueryMode,
required this.appWidth,
required this.themeId,
});

WoxSetting.fromJson(Map<String, dynamic> json) {
mainHotkey = json['MainHotkey'];
Expand All @@ -37,18 +38,25 @@ class WoxSetting {
hideOnLostFocus = json['HideOnLostFocus'];
showTray = json['ShowTray'];
langCode = json['LangCode'];

if (json['QueryHotkeys'] != null) {
queryHotkeys = <QueryHotkey>[];
json['QueryHotkeys'].forEach((v) {
queryHotkeys.add(QueryHotkey.fromJson(v));
});
} else {
queryHotkeys = <QueryHotkey>[];
}

if (json['QueryShortcuts'] != null) {
queryShortcuts = <QueryShortcut>[];
json['QueryShortcuts'].forEach((v) {
queryShortcuts.add(QueryShortcut.fromJson(v));
});
} else {
queryShortcuts = <QueryShortcut>[];
}

lastQueryMode = json['LastQueryMode'];
appWidth = json['AppWidth'];
themeId = json['ThemeId'];
Expand Down

0 comments on commit b6d0d60

Please sign in to comment.