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

Should we customize AnimationController in Badge class to give better control over animating the badges?

wamynobe opened this issue · comments

Environment

master

Describe your question

I'm wondering if adding two variables animationController and appearanceController would give better control over animating the badges?

class Badge extends StatefulWidget {
  const Badge({
    ...
    this.animationController,
  }) : super(key: key);

final AnimationController? animationController;
...

@override
  void initState() {
    super.initState();
    _animationController = widget.animationController ??
        AnimationController(
          duration: widget.badgeAnimation.animationDuration,
          reverseDuration: widget.badgeAnimation.animationDuration,
          vsync: this,
        );
     ...
  }
}

There are some cases where the content of the badge changes or doesn't change, but I still want the badge to animate every time an event is caught.

This approach will cause some issues with logic inside mixin tickerprovider. Added another approach to access these controller.