Skip to content

Commit

Permalink
Version 3.0.0-rc ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Klerith committed Nov 13, 2022
1 parent 94ca5c4 commit 62affff
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 29 deletions.
40 changes: 40 additions & 0 deletions lib/src/animate_do_attention_seekers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ class _BounceState extends State<Bounce> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -192,6 +197,11 @@ class _FlashState extends State<Flash> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -293,6 +303,11 @@ class _PulseState extends State<Pulse> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -417,6 +432,11 @@ class _SwingState extends State<Swing> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -523,6 +543,11 @@ class _SpinState extends State<Spin> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -617,6 +642,11 @@ class _SpinPerfectState extends State<SpinPerfect>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -719,6 +749,11 @@ class _DanceState extends State<Dance> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -819,6 +854,11 @@ class _RouletteState extends State<Roulette>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down
10 changes: 10 additions & 0 deletions lib/src/animate_do_bounces.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ class _BounceInDownState extends State<BounceInDown>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -218,6 +223,11 @@ class _BounceInLeftState extends State<BounceInLeft>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down
15 changes: 15 additions & 0 deletions lib/src/animate_do_elastics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class _ElasticInState extends State<ElasticIn>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -186,6 +191,11 @@ class _ElasticInDownState extends State<ElasticInDown>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -341,6 +351,11 @@ class _ElasticInLeftState extends State<ElasticInLeft>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down
20 changes: 20 additions & 0 deletions lib/src/animate_do_fadeouts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ class _FadeOutState extends State<FadeOut> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to original
if( !widget.animate ) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -169,6 +174,11 @@ class _FadeOutDownState extends State<FadeOutDown>
controller?.forward();
}

/// If FALSE, animate everything back to original
if( !widget.animate ) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -308,6 +318,11 @@ class _FadeOutUpState extends State<FadeOutUp>
controller?.forward();
}

/// If FALSE, animate everything back to original
if( !widget.animate ) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -447,6 +462,11 @@ class _FadeOutLeftState extends State<FadeOutLeft>
controller?.forward();
}

/// If FALSE, animate everything back to original
if( !widget.animate ) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down
53 changes: 52 additions & 1 deletion lib/src/animate_do_fades.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FadeIn extends StatefulWidget {
FadeIn(
{key,
required this.child,
this.duration = const Duration(milliseconds: 300),
this.duration = const Duration(milliseconds: 500),
this.delay = const Duration(milliseconds: 0),
this.controller,
this.manualTrigger = false,
Expand All @@ -39,8 +39,13 @@ class FadeIn extends StatefulWidget {
/// FadeState class
/// The animation magic happens here
class _FadeInState extends State<FadeIn> with SingleTickerProviderStateMixin {
/// Animation controller that controls this animation
AnimationController? controller;

/// is the widget disposed?
bool disposed = false;

/// Animation movement value
late Animation<double> animation;

@override
Expand Down Expand Up @@ -72,10 +77,18 @@ class _FadeInState extends State<FadeIn> with SingleTickerProviderStateMixin {

@override
Widget build(BuildContext context) {

/// Launch the animation ASAP or wait if is needed
if (widget.animate && widget.delay.inMilliseconds == 0) {
controller?.forward();
}

/// If the animation already happen, we can animate it back
if (!widget.animate) {
controller?.animateBack(0);
}

/// Builds the animation with the corresponding
return AnimatedBuilder(
animation: animation,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -129,10 +142,17 @@ class FadeInDown extends StatefulWidget {
class _FadeInDownState extends State<FadeInDown>
with SingleTickerProviderStateMixin {
AnimationController? controller;

/// is the widget disposed?
bool disposed = false;

/// animation movement
late Animation<double> animation;

/// animation opacity
late Animation<double> opacity;


@override
void dispose() {
disposed = true;
Expand Down Expand Up @@ -160,9 +180,11 @@ class _FadeInDownState extends State<FadeInDown>
});
}

/// Returns the controller if the user requires it
if (widget.controller is Function) {
widget.controller!(controller!);
}

}

@override
Expand All @@ -171,6 +193,11 @@ class _FadeInDownState extends State<FadeInDown>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -269,10 +296,19 @@ class FadeInUp extends StatefulWidget {
/// The animation magic happens here
class _FadeInUpState extends State<FadeInUp>
with SingleTickerProviderStateMixin {

/// Animation controller if requested
AnimationController? controller;

/// widget is disposed?
bool disposed = false;

/// Animation movement
late Animation<double> animation;

/// Animation opacity
late Animation<double> opacity;

@override
void dispose() {
disposed = true;
Expand Down Expand Up @@ -310,6 +346,11 @@ class _FadeInUpState extends State<FadeInUp>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -450,6 +491,11 @@ class _FadeInLeftState extends State<FadeInLeft>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -590,6 +636,11 @@ class _FadeInRightState extends State<FadeInRight>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down
10 changes: 10 additions & 0 deletions lib/src/animate_do_flips.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class _FlipInXState extends State<FlipInX> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -174,6 +179,11 @@ class _FlipInYState extends State<FlipInY> with SingleTickerProviderStateMixin {
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down
10 changes: 10 additions & 0 deletions lib/src/animate_do_slides.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ class _SlideInUpState extends State<SlideInUp>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down Expand Up @@ -212,6 +217,11 @@ class _SlideInLeftState extends State<SlideInLeft>
controller?.forward();
}

/// If FALSE, animate everything back to the original state
if (!widget.animate) {
controller?.animateBack(0);
}

return AnimatedBuilder(
animation: controller!,
builder: (BuildContext context, Widget? child) {
Expand Down
Loading

0 comments on commit 62affff

Please sign in to comment.