搜索插件、代码仓与 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

源码仓库

使用此插件的项目