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

app_badge_plus 封面
套件詳情v1.4.0

app_badge_plus

一個用於在應用程式圖示上新增徽章的 Flutter 插件。支援 iOS、Android 和 macOS。

AndroidiOSmacOS
近 30 天下載
38.1萬
喜歡數
172
Pub 分數
160

安裝套件

flutter pub add app_badge_plus

套件介紹

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

AppBadgePlus 是一個 Flutter 插件,可在 Android、iOS 和 macOS 平台上為應用程式圖示顯示徽章。它提供簡單的 API 來動態更新徽章計數,適用於通知、訊息或任務指示器。該插件可無縫整合至現有的 Flutter 應用程式中,並支援整數與自訂徽章標籤。專為跨平台一致性設計,確保在各作業系統支援的範圍內顯示徽章。非常適合需要在主畫面圖示上即時更新狀態的應用程式。

適用情境

  • 顯示未讀訊息數量
  • 顯示待處理任務通知
  • 指示新內容可用
  • 即時更新應用程式圖示徽章
  • 透過視覺提示增強使用者參與度

主要特色

  • 跨平台支援(Android、iOS、macOS)
  • 用於徽章更新的簡單 API
  • 支援整數和自定義徽章標籤
  • 即時徽章渲染
  • 最簡設定和整合

適合對象

  • 訊息和聊天應用
  • 任務和生產力應用
  • 通知密集型應用
  • 動態內容更新的應用程式
  • 針對多個平台的開發者

使用建議

  • 徽章支援因平台和作業系統版本而異
  • 某些平台可能限制徽章計數大小
  • 並非所有裝置都支援自訂徽章文字
  • 某些系統需要特定平台的權限
  • 有限的視覺自定義選項

原始 README

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

app_badge_plus

Pub Version Pub Points GitHub

A Flutter plugin for adding badges to your app icon. Supports iOS, Android, and macOS.

iOS pixel samsung macOS

Supported Platforms

  • iOS
  • Android
    • Samsung (pass)
    • Oppo (pass)
    • Vivo (pass)
    • Huawei (pass)
    • Xiaomi / POCO (HyperOS)
    • LG
    • Sony
    • HTC
    • ZTX
  • macOS

Mark

Android

Starting with Android 8.0 (API level 26), notification badges—also known as notification dots—appear on a launcher icon when the associated app has an active notification. Users can touch & hold the app icon to reveal the notifications, along with any app shortcuts.

https://developer.android.com/develop/ui/views/notifications/badges

Starting With Android13 (API level 33), notification runtime permission should be requested before setting the app badge.

On POCO / Xiaomi HyperOS, numeric badges are driven by active notifications (the old extraNotification API is unavailable). Grant notification permission and enable the numeric badge style in system settings.

Add the following permissions to AndroidManifest.xml according to the system you need to support:

<!-- Samsung -->
<uses-permission android:name="com.sec.android.provider.badge.permission.READ"/>
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/>

<!-- HTC -->
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/>
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT"/>

<!-- Sony -->
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE"/>
<uses-permission android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE"/>

<!-- Apex -->
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT"/>

<!-- Solid -->
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>

<!-- Huawei -->
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
iOS

On iOS, when using with notification message, notification permission is required.

macOS

On macOS, when using with notification message, notification permission is required.

permission_handler

Using permission_handler package to manage permission on Android and iOS.

https://pub.dev/packages/permission_handler

Usage

To use this plugin, add app_badge_plus as a dependency in your pubspec.yaml file.

dependencies:
  app_badge_plus: ^1.1.2

Example

import 'package:app_badge_plus/app_badge_plus.dart';

// Set badge
AppBadgePlus.updateBadge(5);

// Remove badge
AppBadgePlus.updateBadge(0);

// Whether the launcher supports badges. It always returns true on iOS and it will return false on Android if the launcher doesn't support badges.
AppBadgePlus.isSupported();

Compare

flutter_app_badger

https://pub.dev/packages/flutter_app_badger

Set badge
FlutterAppBadger.updateBadgeCount(1);

replace to

AppBadgePlus.updateBadge(1);
Remove badge
FlutterAppBadger.removeBadge();

replace to

AppBadgePlus.updateBadge(0);
Device support
FlutterAppBadger.isAppBadgeSupported();

using dart API:

import 'dart:io';

Platform.isAndroid || Platform.isIOS

所屬分類

依賴

依賴清單 1 項

  • plugin_platform_interface^2.1.8

原始碼儲存庫

使用此套件的專案