creating badges for flutter
a flutter package for creating badges.
installing:
in your pubspec.yaml
dependencies:
badges: ^1.0.0
import 'package:badges/badges.dart';
basic usage:
badge(
badgecontent: text('3'),
child: icon(icons.settings),
)
animations:
badgeanimationtype.slide |
badgeanimationtype.scale |
badgeanimationtype.fade |
custom usage
there are several options that allow for more control:
properties | description |
---|---|
widget badgecontent |
the content of badge. usually text or icon . |
color badgecolor |
background color of the badge. |
widget child |
the main widget. by default it’s below the red badge. usually icon , iconbutton , text or button. |
double elevation |
shadow of the badge. |
bool toanimate |
whether animate badge when badge content changed or not. |
badgeposition position |
can 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 shape |
badgeshape.circle or badgeshape.square . you can use borderradius to change border radius of badge of you use square badgeshape.square . |
double borderradius |
border radius of badge. applies only if badgeshape.square is used. |
edgeinsets padding |
the padding of badge content. |
duration animationduration |
the duration of badge animation when badge content is changed. |
badgeanimationtype animationtype |
can be one of badgeanimationtype.slide , badgeanimationtype.scale or badgeanimationtype.fade . |
Comments are closed.