'Play & pause a Flutter animation
I was trying to add a button to this page that will (play or pause) the waves animation in the background. code link: https://github.com/apgapg/flutter_profile/blob/master/lib/page/intro_page.dart
I've tried many things but since I still bad with flutter animations I still without result.
Thanks in advance.
Solution 1:[1]
When you directly have access to the AnimationController this snippet will start/stop the animation, wherever it left off.
animationController.isAnimating
? animationController.stop()
: animationController.forward();
Here the .isAnimating property is of type bool and is true when the animationController is animating at the moment. Depending on the result .stop()/.forward() will stop/start the animation respectively.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jakob Gerhardt |
