feat: add flutter tray and hide logic of main window

This commit is contained in:
Kingtous
2022-11-02 10:22:41 +08:00
parent 3f8c7fd4f4
commit 4f301bd0b5
5 changed files with 36 additions and 17 deletions

View File

@@ -509,14 +509,15 @@ class WindowActionPanelState extends State<WindowActionPanel>
onTap: () async {
final res = await widget.onClose?.call() ?? true;
if (res) {
if (widget.isMainWindow) {
windowManager.close();
} else {
// only hide for multi window, not close
Future.delayed(Duration.zero, () {
// hide for all window
// note: the main window can be restored by tray icon
Future.delayed(Duration.zero, () {
if (widget.isMainWindow) {
windowManager.hide();
} else {
WindowController.fromWindowId(windowId!).hide();
});
}
}
});
}
},
isClose: true,