搜尋套件、儲存庫與 APP 分類

local_notifier 封面
套件詳情v0.1.6

local_notifier

此外掛程式允許 Flutter 桌面應用程式顯示本機通知。

macOSWindowsLinux
近 30 天下載
5.4萬
喜歡數
116
Pub 分數
150

安裝套件

flutter pub add local_notifier

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

local_notifier 套件讓 Flutter 桌面應用程式能在 macOS、Windows 與 Linux 上顯示本機通知。它提供一個簡單的介面,用於排程與顯示系統層級通知,無需依賴外部服務。專為桌面平台設計,它與原生通知系統整合,以即時傳遞警示。此外掛輕巧且容易實作,非常適合需要提醒、狀態更新或使用者警示的應用程式。支援基本的通知功能,例如標題、內文與圖示顯示。

適用情境

  • 桌面應用程式提醒
  • 系統級警報
  • 任務完成通知
  • 使用者活動追蹤
  • 應用狀態更新

主要特色

  • 原生桌面通知整合
  • 跨平台支援(macOS、Windows、Linux)
  • 用於排程和顯示通知的簡單 API
  • 支援自訂圖示
  • 輕量級且依賴項最少

適合對象

  • Flutter 開發人員建構桌面應用程式
  • 需要本地警示功能的應用程式
  • 針對多個桌面操作系統的開發者
  • 需要輕量級通知解決方案的項目

使用建議

  • 僅限桌面平台
  • 不支援行動裝置
  • 通知行為因作業系統而異
  • 需要平台特定設定以啟用進階功能
  • 不支援豐富媒體或互動式通知

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

🚀 Ship Your App Faster: Try Fastforge - The simplest way to build, package and distribute your Flutter apps.

local_notifier

pub version

This plugin allows Flutter desktop apps to displaying local notifications.


English | 简体中文


Platform Support

Linux macOS Windows
✔️ ✔️ ✔️

Screenshots

macOS Linux Windows
image

Quick Start

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  local_notifier: ^0.1.6

Or

dependencies:
  local_notifier:
    git:
      url: https://github.com/leanflutter/local_notifier.git
      ref: main
Linux requirements
  • libnotify

Run the following command

sudo apt-get install libnotify-dev
Usage
// Add in main method.
await localNotifier.setup(
  appName: 'local_notifier_example',
  // The parameter shortcutPolicy only works on Windows
  shortcutPolicy: ShortcutPolicy.requireCreate,
);

LocalNotification notification = LocalNotification(
  title: "local_notifier_example",
  body: "hello flutter!",
);
notification.onShow = () {
  print('onShow ${notification.identifier}');
};
notification.onClose = (closeReason) {
  // Only supported on windows, other platforms closeReason is always unknown.
  switch (closeReason) {
    case LocalNotificationCloseReason.userCanceled:
      // do something
      break;
    case LocalNotificationCloseReason.timedOut:
      // do something
      break;
    default:
  }
  print('onClose ${_exampleNotification?.identifier} - $closeReason');
};
notification.onClick = () {
  print('onClick ${notification.identifier}');
};
notification?.onClickAction = (actionIndex) {
  print('onClickAction ${notification?.identifier} - $actionIndex');
};

notification.show();

Please see the example app of this plugin for a full example.

Who's using it?

Related Links

  • https://github.com/mohabouje/WinToast

License

MIT

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案