Skip to content

Commit

Permalink
Added animation duration
Browse files Browse the repository at this point in the history
  • Loading branch information
yadaniyil committed Nov 5, 2018
1 parent 782c6c5 commit 5289e1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class _MyHomePageState extends State<MyHomePage> {
icon: _icon,
padding: EdgeInsets.all(2.0),
shape: BadgeShape.card,
animationDuration: Duration(seconds: 2),
textStyle: TextStyle(
fontSize: 10.0,
color: Colors.white,
Expand Down
6 changes: 4 additions & 2 deletions lib/src/badge_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class BadgeIconButton extends StatefulWidget {
final BadgeShape shape;
final TextStyle textStyle;
final EdgeInsets padding;
final Duration animationDuration;

BadgeIconButton(
{Key key,
Expand All @@ -32,7 +33,8 @@ class BadgeIconButton extends StatefulWidget {
color: Colors.white,
fontWeight: FontWeight.bold,
),
this.padding: const EdgeInsets.all(5.0)})
this.padding: const EdgeInsets.all(5.0),
this.animationDuration: const Duration(milliseconds: 500)})
: assert(itemCount >= 0),
assert(badgeColor != null),
super(key: key);
Expand Down Expand Up @@ -115,7 +117,7 @@ class BadgeIconButtonState extends State<BadgeIconButton>
void initState() {
super.initState();
_animationController = AnimationController(
duration: const Duration(milliseconds: 500),
duration: widget.animationDuration,
vsync: this,
);
_animation =
Expand Down

0 comments on commit 5289e1e

Please sign in to comment.