-
Notifications
You must be signed in to change notification settings - Fork 469
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
FlareActor callback never called #198
Comments
The callback registered within class SpeedController extends FlareController {
[...]
FlareCompletedCallback onAnimationCompleted;
// Optional param spped defaults to 1 if not provided
SpeedController(this.animationName, {this.speed = 1, this.onAnimationCompleted});
@override
bool advance(FlutterActorArtboard artboard, double elapsed) {
if (_animation == null) {
return false;
}
if (_animation.isLooping) {
_time %= _animation.duration;
}
_animation.apply(_time, artboard, 1.0);
_time += elapsed * speed;
if (_time > _animation.duration && onAnimationCompleted != null) {
onAnimationCompleted(_animation.name);
}
// Stop advancing if animation is done and we're not looping.
return _animation.isLooping || _time < _animation.duration;
}
[...]
} |
Thanks @umberto-sonnino but is there any documentation on how FlareCompletedCallback works? Changes above crash when |
In the snippet above, you need to specify a callback in the constructor for it to not crash. I'll update it with a null check! SpeedController(
myAnimationName,
onAnimationCompleted: (name) {
print("Animation $name completed!");
}
) |
Continuing to try and get a basic countdown going. Sample code uses the flare speed control example https://github.com/luigi-rosso/flare_control_speed_example/blob/master/lib/main.dart
Using flare_flutter 1.7.3
This code never prints"finished":
The text was updated successfully, but these errors were encountered: