Tuesday 6 August 2019

A flutter package for creating badges



Badges for Flutter

A flutter package for creating badges.

Installing:

In your pubspec.yaml
dependencies:
  badges: ^1.0.0
YAML
import 'package:badges/badges.dart';
Dart

Basic Usage:

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

Custom Usage

There are several options that allow for more control:
PROPERTIESDESCRIPTION
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 IconIconButtonText or button.
double elevationShadow of the badge.
bool toAnimateWhether animate badge when badge content changed or not.
BadgePosition positionCan be one of BadgePosition.topLeft()BadgePosition.topRight()BadgePosition.bottomLeft()BadgePosition.bottomRight(). Sometimes you want to create unique badge position or create new one manually. For this use BadgePosition.topRight(top: -12, right: -20) or BadgePosition.(left, top, right, bottom).
BadgeShape shapeBadgeShape.circle or BadgeShape.square. You can use borderRadius to change border radius of badge of you use square BadgeShape.square.
double borderRadiusBorder radius of badge. Applies only if BadgeShape.square is used.
EdgeInsets paddingThe padding of badge content.
Duration animationDurationThe duration of badge animation when badge content is changed.
BadgeAnimationType animationTypeCan be one of BadgeAnimationType.slideBadgeAnimationType.scale or BadgeAnimationType.fade.

GitHub

A flutter package for creating badges. — Read More
Latest commit to the master branch on 7-2-2019
Download as zip