Improving FlareComponent API and updating FlareFlutter dependency

This commit is contained in:
Erick Zanardo
2020-01-22 20:57:31 -03:00
parent f5eacb9fcb
commit 200c3da505
5 changed files with 99 additions and 3 deletions

View File

@ -20,6 +20,12 @@ class FlareComponent extends PositionComponent {
});
}
void updateAnimation(String animation) {
if (loaded()) {
_flareAnimation.updateAnimation(animation);
}
}
@override
bool loaded() => _flareAnimation != null;
@ -31,8 +37,20 @@ class FlareComponent extends PositionComponent {
@override
void update(double dt) {
if (_flareAnimation != null) {
if (loaded()) {
_flareAnimation.update(dt);
}
}
@override
set width(_width) {
super.width = _width;
if (loaded()) _flareAnimation.width = width;
}
@override
set height(_height) {
super.height = _height;
if (loaded()) _flareAnimation.height = height;
}
}