Search packages, repositories and app categories

badges cover
Package detailsv4.0.1

badges

A package for creating badges. Badges can be used for an additional marker for any widget, e.g. show a number of items in a shopping cart.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
418K
Likes
3.8K
Pub points
160

Install package

flutter pub add badges

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The badges package provides a simple way to add decorative badges to any widget in Flutter applications. These badges can display numbers, labels, or icons and are commonly used to highlight notifications, cart counts, or status indicators. Designed for ease of use, it supports various customization options such as position, shape, color, and size. The package is compatible across all major platforms including Android, iOS, Web, macOS, Windows, and Linux, making it ideal for cross-platform apps that need consistent visual feedback.

Use cases

  • Displaying item counts in shopping carts
  • Highlighting unread messages or notifications
  • Indicating product availability or status
  • Adding visual markers to UI elements
  • Showing progress or completion levels

Key features

  • Easy integration with any widget
  • Customizable badge content and style
  • Supports multiple positions (top-left, top-right, etc.)
  • Cross-platform compatibility
  • Lightweight and performant
  • Configurable colors and shapes

Suitable for

  • E-commerce apps needing cart counters
  • Messaging or social media apps for notifications
  • Dashboard widgets with status indicators
  • UIs requiring visual feedback for user actions
  • Developers seeking lightweight badge solutions

Considerations

  • May require careful positioning to avoid overlapping with other UI elements
  • Limited built-in animations (external animation packages may be needed)
  • Not designed for complex interactive badges
  • Best suited for simple numeric or label-based indicators
  • Performance impact negligible but should be tested in large lists

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Pub Version popularity likes building style: flutter lints Package of the week

Installing:

In your pubspec.yaml

dependencies:
  badges: ^3.2.0

Attention! In Flutter 3.7 the Badge widget was introduced in the Material library, so to escape the ambiguous imports you need to import the package like this:

Option 1: namespace prefix

import 'package:badges/badges.dart' as badges;

and then use the "badges.Badge" widget instead of the "Badge" widget. The same for all the classes from this package.

Option 2: hide Flutter's Material Badge widget

import 'package:badges/badges.dart';
import 'package:flutter/material.dart' hide Badge;


Basic Usage:

    badges.Badge(
      badgeContent: Text('3'),
      child: Icon(Icons.settings),
    )

Advanced usage

    badges.Badge(
      position: badges.BadgePosition.topEnd(top: -10, end: -12),
      showBadge: true,
      ignorePointer: false,
      onTap: () {},
      badgeContent:
          Icon(Icons.check, color: Colors.white, size: 10),
      badgeAnimation: badges.BadgeAnimation.rotation(
        animationDuration: Duration(seconds: 1),
        colorChangeAnimationDuration: Duration(seconds: 1),
        loopAnimation: false,
        curve: Curves.fastOutSlowIn,
        colorChangeAnimationCurve: Curves.easeInCubic,
      ),
      badgeStyle: badges.BadgeStyle(
        shape: badges.BadgeShape.square,
        badgeColor: Colors.blue,
        padding: EdgeInsets.all(5),
        borderRadius: BorderRadius.circular(4),
        borderSide: BorderSide(color: Colors.white, width: 2),
        borderGradient: badges.BadgeGradient.linear(
            colors: [Colors.red, Colors.black]),
        badgeGradient: badges.BadgeGradient.linear(
            colors: [Colors.blue, Colors.yellow],
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
        ),
        elevation: 0,
      ),
      child: Text('Badge'),
    ),


Animations:

From left to right:
1) Color change animation 2) BadgeAnimation.slide 3) BadgeAnimation.fade 4) BadgeAnimation.scale 5) BadgeAnimation.size 6) BadgeAnimation.rotation
Also, loop animation is available, this will loop the animation until you stop it.


Shapes:

From left to right:
1) BadgeShape.circle 2) BadgeShape.square 3) BadgeShape.twitter 4) BadgeShape.instagram


Migration from Badges 2:

Check out other Yako packages:

Badges

Settings UI

Status Alert

Full Screen Menu

Diagonal decoration

Yako Yheme Switch

and more to come!

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

Rankings