From bff43488906005b5b997917a4844d6b446df1067 Mon Sep 17 00:00:00 2001 From: igoogolx <27353191+igoogolx@users.noreply.github.com> Date: Fri, 3 Jan 2025 21:43:43 +0800 Subject: [PATCH] v1.26.1 (#61) * feat: allow opening web dashboard from the tray on Windows * chore: v1.26.1 --- lib/main.dart | 9 +++++++-- lib/tray.dart | 2 ++ pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 9cae07d..93e12ce 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,7 +14,7 @@ import 'package:path_provider/path_provider.dart'; import 'package:uuid/uuid.dart'; import 'package:version/version.dart'; import 'package:window_manager/window_manager.dart'; - +import 'package:url_launcher/url_launcher.dart'; var uuid = Uuid(); @@ -28,6 +28,11 @@ void exitApp() { exit(0); } +void openDashboard() async { + final Uri url = Uri.parse(urlStr); + launchUrl(url); +} + void main(args) async { WidgetsFlutterBinding.ensureInitialized(); await notifier.ensureInitialized(); @@ -70,7 +75,7 @@ void main(args) async { windowManager.waitUntilReadyToShow(windowOptions, () async {}); if (Platform.isWindows) { - initSystemTray(exitApp, () { + initSystemTray(openDashboard,exitApp, () { windowManager.show(); windowManager.focus(); }); diff --git a/lib/tray.dart b/lib/tray.dart index e6e7988..6246ab8 100644 --- a/lib/tray.dart +++ b/lib/tray.dart @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart'; import 'package:system_tray/system_tray.dart'; Future initSystemTray( + void Function() openDashboard, exitApp, focusWindow, ) async { @@ -18,6 +19,7 @@ Future initSystemTray( final Menu menu = Menu(); final List menuItems = [ MenuItemLabel(label: 'Lux', enabled: false), + MenuItemLabel(label: 'Web Dashboard', onClicked: (menuItem) => openDashboard()), MenuItemLabel(label: 'Exit', onClicked: (menuItem) => exitApp()), ]; diff --git a/pubspec.yaml b/pubspec.yaml index 775f1da..cf9c3fa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.26.0 +version: 1.26.1 environment: sdk: '>=3.0.6 <4.0.0'