badges 2.0.3 icon indicating copy to clipboard operation
badges: ^2.0.3 copied to clipboard

A flutter 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.

Badges for Flutter #

Pub Version

Installing: #

In your pubspec.yaml

  badges: ^2.0.3
import 'package:badges/badges.dart';

Basic Usage: #

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

Animations: #


Chips: #

Sometimes you may want to use chip but it's too big, even if set padding to zero. This is where Badge comes handy.

      padding: EdgeInsets.all(0),
      backgroundColor: Colors.deepPurple,
      label: Text('BADGE', style: TextStyle(color: Colors.white)),
      toAnimate: false,
      shape: BadgeShape.square,
      badgeColor: Colors.deepPurple,
      borderRadius: BorderRadius.circular(8),
      badgeContent: Text('BADGE', style: TextStyle(color: Colors.white)),

Custom Usage #

There are several options that allow for more control:

Widget badgeContentThe content of badge. Usually Text or Icon.
Color badgeColorBackground color of the badge.
Widget childThe main widget. By default it's below the red badge. Usually Icon, IconButton, Text or button.
double elevationShadow of the badge.
Gradient gradientGradient color for the badge content.
bool toAnimateWhether animate badge when badge content changed or not.
BadgePosition positionCan be one of BadgePosition.topStart(), BadgePosition.topEnd(), BadgePosition.bottomStart(), BadgePosition.bottomEnd(). Sometimes you want to create unique badge position or create new one manually. For this use BadgePosition.topEnd(top: -12, end: -20) or BadgePosition(start, top, end, bottom).
BadgeShape or BadgeShape.square. You can use borderRadius to change border radius of badge of you use square BadgeShape.square.
BorderRadiusGeometry borderRadiusBorder radius of badge. Applies only if BadgeShape.square is used.
EdgeInsetsGeometry paddingThe padding of badge content.
Duration animationDurationThe duration of badge animation when badge content is changed.
BadgeAnimationType animationTypeCan be one of BadgeAnimationType.slide, BadgeAnimationType.scale or BadgeAnimationType.fade.
bool showBadgeHide or show badge with animation using bool flag.
AlignmentGeometry alignmentAlignment of the whole widget
bool ignorePointerEnable or disable (default) ignore pointer option
BorderSide borderSideAdds a border to the badge

License #

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

pub points


verified publisher

A flutter 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.



API reference


Icon for licenses.Apache-2.0 (LICENSE)




Packages that depend on badges