Skip to content

Instantly share code, notes, and snippets.

@SahanAmarsha
Last active May 27, 2022 15:39
Show Gist options
  • Save SahanAmarsha/b618e61608e0433b1ffc2a8d938f6214 to your computer and use it in GitHub Desktop.
Save SahanAmarsha/b618e61608e0433b1ffc2a8d938f6214 to your computer and use it in GitHub Desktop.
Defining a Pulse/Resize Animation in Flutter
AnimationController _controller;
Animation<Size> _myAnimation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(milliseconds: 1000),
);
_myAnimation = Tween<Size>(
begin: Size(100, 100),
end: Size(120, 120)
).animate(
CurvedAnimation(parent: _controller, curve: Curves.bounceIn)
);
_controller.addStatusListener((AnimationStatus status) {
if (status == AnimationStatus.completed) {
_controller.repeat();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment