v0.1.4+1
flutter_dnd
一個用於管理 Android 上勿擾模式設定的 Flutter 插件。
27喜歡 23近 30 天下載160Pub 分數
Android
一個用於管理 Android 上勿擾模式設定的 Flutter 插件。
{"sdk":"flutter"}{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
pub package A Flutter plugin to manage Do Not Disturb settings on Android.
To use this plugin, add flutter_dnd as a dependency in your pubspec.yaml file.
Make sure you add the following permissions to your Android Manifest
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
// Import package
import 'package:flutter_dnd/flutter_dnd.dart';
if (await FlutterDnd.isNotificationPolicyAccessGranted) {
await FlutterDnd.setInterruptionFilter(FlutterDnd.INTERRUPTION_FILTER_NONE); // Turn on DND - All notifications are suppressed.
} else {
FlutterDnd.gotoPolicySettings();
}
| Filter | Description |
|---|---|
| INTERRUPTION_FILTER_ALL | No notifications are suppressed. |
| INTERRUPTION_FILTER_PRIORITY | Allow priority notifications. |
| INTERRUPTION_FILTER_NONE | Suppress all notifications. |
| INTERRUPTION_FILTER_ALARMS | Allow alarm notifications. |