Last active
July 14, 2018 19:09
-
-
Save salihgueler/ed1036738c690430fa2cd5f4b652a4fb to your computer and use it in GitHub Desktop.
Offset & Delay Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Stateful Widget created for this | |
@override | |
void initState() { | |
super.initState(); | |
_controller = | |
AnimationController(vsync: this, duration: Duration(seconds: 2)); | |
void handler(status) { | |
if (status == AnimationStatus.completed) { | |
_animation.removeStatusListener(handler); | |
_controller.reset(); | |
_animation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( | |
parent: _controller, | |
curve: Curves.fastOutSlowIn, | |
)); | |
_lateAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( | |
parent: _controller, | |
curve: Interval( | |
0.2, | |
1.0, | |
curve: Curves.fastOutSlowIn, | |
))) | |
..addStatusListener((status) { | |
if (status == AnimationStatus.completed) { | |
Navigator.pop(context); | |
} | |
}); | |
_controller.forward(); | |
} | |
} | |
_animation = Tween(begin: -1.0, end: 0.0).animate(CurvedAnimation( | |
parent: _controller, | |
curve: Curves.fastOutSlowIn, | |
)) | |
..addStatusListener(handler); | |
_lateAnimation = Tween(begin: -1.0, end: 0.0).animate(CurvedAnimation( | |
parent: _controller, | |
curve: Interval( | |
0.2, | |
1.0, | |
curve: Curves.fastOutSlowIn, | |
))); | |
} | |
// Views to have this animations. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment