-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Hide after animation completes #24
Comments
I added an example that shows how to hide the animation when complete: The important part are: Add a status listener on the animation controller and update a variable when the animation is completed. _animationController = AnimationController(vsync: this)
..addStatusListener((status) {
if (status == AnimationStatus.completed) {
setState(() {
_showAnimation = false;
});
}
}); Conditionally display the animation if (_showAnimation)
Lottie.asset(
'assets/LottieLogo1.json',
controller: _animationController,
onLoaded: (composition) {
animationController
..duration = composition.duration
..reset()
..forward();
},
), |
It works like charm. |
Awesome, thanks mate |
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I hide lottie after the animation completes?
The text was updated successfully, but these errors were encountered: