Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add duration of the appearance Badge #70

Merged
merged 5 commits into from
Nov 9, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/src/badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Badge extends StatefulWidget {
this.stackFit = StackFit.loose,
this.gradient,
this.onTap,
this.appearanceDuration = const Duration(milliseconds: 200),
}) : super(key: key);

/// Widget that will be wrapped by this [badgeContent].
Expand Down Expand Up @@ -94,6 +95,11 @@ class Badge extends StatefulWidget {
/// * [animationType]
final Duration animationDuration;

/// Сontrols the duration of the appearance Badge.
yadaniyil marked this conversation as resolved.
Show resolved Hide resolved
///
/// The default value is Duration(milliseconds: 200).
final Duration appearanceDuration;

/// Controls the type of the animation.
///
/// The default value is [BadgeAnimationType.slide].
Expand Down Expand Up @@ -225,7 +231,7 @@ class BadgeState extends State<Badge> with SingleTickerProviderStateMixin {
Widget badgeView() {
return AnimatedOpacity(
opacity: widget.showBadge ? 1 : 0,
duration: const Duration(milliseconds: 200),
duration: widget.animationDuration,
child: Material(
shape: border,
elevation: widget.elevation,
Expand All @@ -241,7 +247,7 @@ class BadgeState extends State<Badge> with SingleTickerProviderStateMixin {
Widget badgeViewGradient() {
return AnimatedOpacity(
opacity: widget.showBadge ? 1 : 0,
duration: const Duration(milliseconds: 200),
duration: widget.animationDuration,
child: Material(
shape: border,
elevation: widget.elevation,
Expand Down