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

套件詳情v0.1.4+1

flutter_dnd

一個用於管理 Android 上勿擾模式設定的 Flutter 插件。

Android
近 30 天下載
17
喜歡數
27
Pub 分數
160

安裝套件

flutter pub add flutter_dnd

套件介紹

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

一個 Flutter 插件,可在 Android 裝置上管理勿擾模式(DND)設定。它允許應用程式以程式設計方式檢查、啟用或修改 DND 模式,包括優先權規則和時間排程。專為需要尊重使用者專注模式或與系統層級通知控制整合的開發者設計。該插件提供簡單介面,可與 Android 的 DND API 互動,無需了解原生程式碼知識。此插件為平台特定,僅支援 Android。

適用情境

  • 在生產力應用中管理通知中斷
  • 在預定時間段內尊重用戶焦點模式
  • 與警報或提醒系統整合
  • 在特定事件期間啟用靜音模式
  • 透過程式化方式檢查目前的勿擾模式狀態

主要特色

  • 檢查並修改勿擾模式狀態
  • 支援優先權規則與時間範圍
  • 僅限 Android 的平台支援
  • 簡單的 Dart API
  • 基本用法不需要原生程式碼

適合對象

  • 生產力和提醒應用
  • 鬧鐘和睡眠追蹤工具
  • 需要靜音模式整合的應用程式
  • 針對 Android DND 功能的開發者

使用建議

  • 僅限 Android 平台
  • 需要執行時權限以變更勿擾模式
  • 在不同版本的 Android 上行為可能有所不同
  • 在某些情況下,使用者必須手動授予DND存取權限
  • 與 iOS 不相容

原始 README

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

flutter_dnd

pub package A Flutter plugin to manage Do Not Disturb settings on Android.

Usage

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"/>

Example

// 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();
}
Other filters
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.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。