windows_notification 套件讓 Flutter 應用程式在 Windows 上使用可自訂範本發送系統通知。它與 Windows 通知 API 整合,允許開發者顯示帶有標題、訊息以及豐富內容(例如圖像和按鈕)的氣泡通知。此套件非常適合需要及時使用者警示或狀態更新的桌面應用程式。它支援簡單與進階的通知版面配置,適用於生產力工具、通訊應用程式和背景服務。該套件輕量級且專為 Windows 平台設計。
適用情境
發送應用警示
顯示系統通知
使用者活動提醒
背景任務通知
即時更新顯示
主要特色
可自訂的通知範本
對豐富內容(例如圖片)的支援
與 Windows 通知 API 的整合
簡單直覺的 API
Windows 平台特定
適合對象
Windows 桌面應用
生產力工具
訊息應用
背景服務
系統監控工具
使用建議
僅限 Windows 平台
需要 Windows 10 或更新版本
不支援 Linux 或 macOS
通知行為可能因 Windows 版本而異
在某些環境中,可能需要設定權限
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
A library for sending notifications on Windows using Flutter
Features
Sending notifications by ready-made templates of the plugin
Send notifications by user-created templates
Receive notification events sent
Delete all notifications sent by you from Windows Action Center
Delete notifications group sent by you from Windows Action Center
Add deep link to notification
Usage
Send notification with plugin template
Sending notifications through the plugin's own templates, there are currently 3 template available in the plugin.
import'package:windows_notification/notification_message.dart';
import'package:windows_notification/windows_notification.dart';
// Create an instance of Windows Notification with your application name// application id must be null in packaged modefinal _winNotifyPlugin = WindowsNotification(applicationId: "r"{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}\WindowsPowerShell\v1.0\powershell.exe"");
// create new NotificationMessage instance with id, title, body, and imagesNotificationMessage message = NotificationMessage.fromPluginTemplate(
"test1",
"TEXT",
"TEXT",
largeImage: file_path,
image: file_path
);
// show notification
_winNotifyPlugin.showNotificationPluginTemplate(message);
Notification with imge and large image
Notification with imge
notification without any image
Send notification with custom template
You can use the template made by you to send the notification
You can find a lot of templates code with a simple search on the Internet
The Launch option allows you to embed your app's deep leak into the notification, and the target user will be redirected to the relevant page by tapping on the notification.
NotificationMessage message = NotificationMessage.fromPluginTemplate(
"test1", "You Win", "Tap to receive a gift",
launch: "my-app-schame://page1");
_winNotifyPlugin.showNotificationPluginTemplate(message);
Feature requests and bugs
Please file feature requests and bugs at the issue tracker.
If you want to contribute to this library, please submit a Pull Request.