v0.1.6local_notifier
此插件允许 Flutter 桌面应用程序显示本地通知。
116喜欢 4.9万近 30 天下载150Pub 分数
macOSWindowsLinux
此插件允许Flutter桌面应用程序通知本地通知。
以下为英文项目原文快照,最新内容请访问 GitHub。
🚀 Ship Your App Faster: Try Fastforge - The simplest way to build, package and distribute your Flutter apps.
This plugin allows Flutter desktop apps to displaying local notifications.
English | 简体中文
| Linux | macOS | Windows |
|---|---|---|
| ✔️ | ✔️ | ✔️ |
| macOS | Linux | Windows |
|---|---|---|
![]() |
![]() |
![]() |
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
libnotifyRun the following command
sudo apt-get install libnotify-dev
// 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.
依赖清单 4 项
{"sdk":"flutter"}>=3.0.7 <5.0.0{"sdk":"flutter"}^0.1.1先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗