diff --git a/sky/sdk/example/widgets/piano.dart b/sky/sdk/example/widgets/piano.dart index c976d4ae9c9e58c140ae7450fc825bd22c9eeb53..23737e210b2417b0166a959fb4a0f626a7788f98 100644 --- a/sky/sdk/example/widgets/piano.dart +++ b/sky/sdk/example/widgets/piano.dart @@ -68,7 +68,6 @@ class PianoApp extends App { } mediaService.close(); // Are we leaking all the player connections? - scheduleBuild(); } Widget build() { diff --git a/sky/sdk/lib/widgets/animated_component.dart b/sky/sdk/lib/widgets/animated_component.dart index 92683e094517393eb91e7ccb1a324805a17056f2..3ebb9c55670d41b59f12a321cfd9ddcb6fb6b654 100644 --- a/sky/sdk/lib/widgets/animated_component.dart +++ b/sky/sdk/lib/widgets/animated_component.dart @@ -13,22 +13,29 @@ abstract class AnimatedComponent extends StatefulComponent { final List _watchedPerformances = new List(); + void _performanceChanged() { + setState(() { + // We don't actually have any state to change, per se, + // we just know that we have in fact changed state. + }); + } + void watch(AnimationPerformance performance) { assert(!_watchedPerformances.contains(performance)); _watchedPerformances.add(performance); if (mounted) - performance.addListener(scheduleBuild); + performance.addListener(_performanceChanged); } void didMount() { for (AnimationPerformance performance in _watchedPerformances) - performance.addListener(scheduleBuild); + performance.addListener(_performanceChanged); super.didMount(); } void didUnmount() { for (AnimationPerformance performance in _watchedPerformances) - performance.removeListener(scheduleBuild); + performance.removeListener(_performanceChanged); super.didUnmount(); } diff --git a/sky/sdk/lib/widgets/widget.dart b/sky/sdk/lib/widgets/widget.dart index a7de0ca712bd5a4d53ee32325864089123114c5b..3624213922027aa693b3df123052a529b60b7f01 100644 --- a/sky/sdk/lib/widgets/widget.dart +++ b/sky/sdk/lib/widgets/widget.dart @@ -530,7 +530,7 @@ abstract class Component extends Widget { } void _dependenciesChanged() { // called by Inherited.sync() - scheduleBuild(); + _scheduleBuild(); } // order corresponds to _build_ order, not depth in the tree. @@ -585,7 +585,7 @@ abstract class Component extends Widget { _sync(null, _slot); } - void scheduleBuild() { + void _scheduleBuild() { if (_isBuilding || _dirty || !_mounted) return; _dirty = true; @@ -662,7 +662,7 @@ abstract class StatefulComponent extends Component { void setState(void fn()) { assert(!_disqualifiedFromEverAppearingAgain); fn(); - scheduleBuild(); + _scheduleBuild(); } } @@ -1190,7 +1190,7 @@ void runApp(App app, { RenderView renderViewOverride, bool enableProfilingLoop: _container = new AppContainer(app); if (enableProfilingLoop) { new Timer.periodic(const Duration(milliseconds: 20), (_) { - app.scheduleBuild(); + app._scheduleBuild(); }); } }