kry0sc0pic / flutter_badges

A flutter package for creating badges.

Home Page:https://pub.dev/packages/badges

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Installing:

In your pubspec.yaml

dependencies:
  badges: ^3.0.0-beta
import 'package:badges/badges.dart';

Basic Usage:

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

Advanced usage

    Badge(
      position: BadgePosition.topEnd(top: -10, end: -12),
      showBadge: true,
      ignorePointer: false,
      onTap: () {},
      badgeContent:
          Icon(Icons.check, color: Colors.white, size: 10),
      badgeAnimation: BadgeAnimation.rotation(
        animationDuration: Duration(seconds: 1),
        colorChangeAnimationDuration: Duration(seconds: 1),
        loopAnimation: false,
        curve: Curves.fastOutSlowIn,
        colorChangeAnimationCurve: Curves.easeInCubic,
      ),
      badgeStyle: BadgeStyle(
        shape: BadgeShape.square,
        badgeColor: Colors.blue,
        padding: EdgeInsets.all(5),
        borderRadius: BorderRadius.circular(4),
        borderSide: BorderSide(color: Colors.white, width: 2),
        borderGradient: BadgeGradient.linear(
            colors: [Colors.red, Colors.black]),
        badgeGradient: 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: Settings UI, Status Alert, Full Screen Menu and more to come!

About

A flutter package for creating badges.

https://pub.dev/packages/badges

License:MIT License


Languages

Language:Dart 82.8%Language:C++ 10.1%Language:CMake 4.9%Language:Ruby 1.3%Language:Objective-C 0.5%Language:C 0.4%Language:Kotlin 0.1%