Initial set of tests for flutter sprites (#3643)

* Initial set of tests for flutter sprites
This commit is contained in:
Viktor Lidholt
2016-04-29 14:46:09 -07:00
parent 01a27ca4ae
commit ed40dd3577
4 changed files with 513 additions and 1 deletions

View File

@@ -63,6 +63,12 @@ class SpriteBox extends RenderBox {
_scheduleTick();
}
@override
void detach() {
super.detach();
_unscheduleTick();
}
// Member variables
// Root node for drawing
@@ -366,8 +372,14 @@ class SpriteBox extends RenderBox {
// Updates
int _frameCallbackId;
void _scheduleTick() {
SchedulerBinding.instance.scheduleFrameCallback(_tick);
_frameCallbackId = SchedulerBinding.instance.scheduleFrameCallback(_tick);
}
void _unscheduleTick() {
SchedulerBinding.instance.cancelFrameCallbackWithId(_frameCallbackId);
}
void _tick(Duration timeStamp) {