Properly propagate onMount and onRemove to children (#579)

* Fix rendering of children

* Game loop handles other restore

* Properly propagate onMount and onRemove to children

* Use BaseGame on gestures to minimize confusion

* Fix linting

* All children don't need preparation

* Add composability example

* gameRef might not be defined

* Add mustCallSuper

* isMounted on game

* Remove unused gameRef argument

* Made isMounted only modifiable by the component

* Move dartdoc to public isMounted

* Fix formatting
This commit is contained in:
Lukas Klingsbo
2020-12-21 12:42:45 +01:00
committed by GitHub
parent fdb12f3265
commit 692213d5a4
15 changed files with 194 additions and 26 deletions

View File

@ -48,6 +48,7 @@ class Square extends PositionComponent with HasGameRef<MyGame> {
@override
void onMount() {
super.onMount();
size = Vector2.all(gameRef.squareSize);
anchor = Anchor.center;
}