diff --git a/lib/home_page.dart b/lib/home_page.dart index 1184db5..703dd0e 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -21,19 +21,6 @@ class _HomePageState extends State with TrayListener { @override void initState() { trayManager.addListener(this); - trayManager.setIcon(''); // TODO - Menu menu = Menu( - items: [ - MenuItem( - key: 'show_window', - label: 'Show Window', - onClick: (menuItem) { - windowManager.show(); - }, - ), - ], - ); - trayManager.setContextMenu(menu); super.initState(); } @@ -60,6 +47,20 @@ class _HomePageState extends State with TrayListener { @override Widget build(BuildContext context) { + trayManager.setIcon(''); // TODO + Menu menu = Menu( + items: [ + MenuItem( + key: 'show_window', + label: AppLocalizations.of(context)!.showWindow, + onClick: (menuItem) { + windowManager.show(); + }, + ), + ], + ); + trayManager.setContextMenu(menu); + return Scaffold( body: Row( children: [ @@ -125,7 +126,7 @@ class _HomePageState extends State with TrayListener { @override void onTrayIconMouseDown() { - trayManager.popUpContextMenu(); + windowManager.show(); } @override diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 6ff0ad7..5ea7b1e 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -18,5 +18,6 @@ "notImplement": "Work in progress", "disconnect": "Disconnect", "use": "Use It", - "configNameComment": "Write a name for this config" + "configNameComment": "Write a name for this config", + "showWindow": "Show Window" } \ No newline at end of file diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 1c38e76..e0a17f0 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -18,5 +18,6 @@ "notImplement": "功能尚未开发, 敬请期待~", "disconnect": "断开连接", "use": "使用", - "configNameComment": "给这个配置备注一个名字" + "configNameComment": "给这个配置备注一个名字", + "showWindow": "显示主面板" } \ No newline at end of file