Skip to content

Commit

Permalink
Refactor action panel show/hide functionality in launcher
Browse files Browse the repository at this point in the history
This update separates the process of showing and hiding the action panel in the launcher controller into dedicated functions. This improves code readability and simplifies the implementation of the action panel toggle mechanism.
  • Loading branch information
qianlifeng committed Mar 6, 2024
1 parent d4d8c75 commit 962910a
Showing 1 changed file with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,28 @@ class WoxLauncherController extends GetxController implements WoxLauncherInterfa
}

if (isShowActionPanel.value) {
isShowActionPanel.value = false;
resultActionTextFieldController.text = "";
queryBoxFocusNode.requestFocus();
hideActionPanel();
} else {
_activeActionIndex.value = 0;
_resultActions.value = queryResults[_activeResultIndex.value].actions;
filterResultActions.value = _resultActions;
for (var _ in filterResultActions) {
_resultActionItemGlobalKeys.add(GlobalKey());
}
isShowActionPanel.value = true;
resultActionFocusNode.requestFocus();
showActionPanel();
}
}

void hideActionPanel() {
isShowActionPanel.value = false;
resultActionTextFieldController.text = "";
queryBoxFocusNode.requestFocus();
_resizeHeight();
}

void showActionPanel() {
_activeActionIndex.value = 0;
_resultActions.value = queryResults[_activeResultIndex.value].actions;
filterResultActions.value = _resultActions;
for (var _ in filterResultActions) {
_resultActionItemGlobalKeys.add(GlobalKey());
}
isShowActionPanel.value = true;
resultActionFocusNode.requestFocus();
_resizeHeight();
}

Expand Down Expand Up @@ -178,6 +187,7 @@ class WoxLauncherController extends GetxController implements WoxLauncherInterfa
"actionId": woxResultAction.id,
});
WoxWebsocketMsgUtil.instance.sendMessage(msg);
hideActionPanel();
if (!woxResultAction.preventHideAfterAction) {
hideApp(traceId);
}
Expand Down

0 comments on commit 962910a

Please sign in to comment.