-
Notifications
You must be signed in to change notification settings - Fork 25
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
Allow callbacks on animation completion #95
Comments
The void listenToAnimationEnding(StrokeOrderAnimationController controller) {
bool wasAnimating = false;
controller.addListener(() {
if (wasAnimating && !controller.isAnimating) {
print('Animation ended');
}
wasAnimating = controller.isAnimating;
});
} You can use this to react to changes in any of the public attributes of the controller. |
Thanks for the reply. |
Do you re-register the listener repeatedly? |
I can be sure that it is only monitored once, because I use Getx to monitor in onInit. Because 111 is only output once. But 222 will be output continuously whether it is during the stroke animation or after the stroke is completed, until Stack Overflow.
logs
|
I think you might have some endless loop going on because you call |
Oh my god, it's really the infinite loop caused by calling |
Does |
Sorry, I don't quite understand what you mean. |
Okay, so that took care of the endless loop 🥳 I am not surprised that the listener gets called multiple times. For example, the controller notifies its listeners when it switches to the next stroke. How about you replace "222" with something more interesting, like |
Okay, Are there plans to provide a callback method for when the animation is finished? It would be great if it were possible. Similar to |
That shouldn't be too hard to add, but I don't have a timeline for it. I'll probably add it next time I need to work on this library. Feel free to open a PR though. |
Ok, thanks for your reply. |
I'll keep this open as a feature request. Thank you for your feedback :) |
How do I know that the animation has finished playing after calling
startAnimation
?The text was updated successfully, but these errors were encountered: