yako-dev / 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

How to use Badges with IconData

cmregazzo opened this issue · comments

Hi,

How do I use the Badge, when the Widget waits for InconData?

Thanks.

@cmregazzo sorry for the delay.
None of the parameters expects IconData.
You can see the full list of parameters below and see for yourself.

  final Widget badgeContent;
  final Color badgeColor;
  final Widget child;
  final double elevation;
  final bool toAnimate;
  final BadgePosition position;
  final BadgeShape shape;
  final EdgeInsetsGeometry padding;
  final Duration animationDuration;
  final BorderRadiusGeometry borderRadius;
  final AlignmentGeometry alignment;
  final BadgeAnimationType animationType;
  final bool showBadge;
  final bool ignorePointer;
  final BorderSide borderSide;

Solution

You can use Badge for icon.
You can make a badge-icon.
Or you can combine it like in the example:

Badge(
  elevation: 0,
  child: Icon(Icons.email),
  badgeColor: Colors.transparent,
  badgeContent: Icon(Icons.fiber_new_outlined),
  position: BadgePosition.topEnd(top: -16, end: -26),
),

So

I'm closing this issue.