Skip to content

Instantly share code, notes, and snippets.

@klaszlo8207
Created January 6, 2020 15:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaszlo8207/82ea215901504ab77ed1f1448bffff82 to your computer and use it in GitHub Desktop.
Save klaszlo8207/82ea215901504ab77ed1f1448bffff82 to your computer and use it in GitHub Desktop.
SimpleAnimatedWidget
import 'package:animator/animator.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class SimpleAnimatedWidget extends StatelessWidget {
SimpleAnimatedWidget({
@required this.child,
@required this.tween,
@required this.builder,
this.curve = Curves.linear,
this.milliseconds = 500,
this.repeats = 1,
this.cycles = 1,
});
final Widget child;
final Tween tween;
final Function(Animation<dynamic>) builder;
Curve curve = Curves.linear;
int milliseconds = 500;
int repeats = 1;
int cycles = 1;
@override
Widget build(BuildContext context) {
return Animator(
triggerOnInit: true,
resetAnimationOnRebuild: true,
repeats: repeats,
cycles: cycles,
tween: tween,
curve: curve,
duration: Duration(milliseconds: milliseconds),
builder: builder,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment