| Index: sky/sdk/lib/widgets/animated_component.dart
|
| diff --git a/sky/sdk/lib/widgets/animated_component.dart b/sky/sdk/lib/widgets/animated_component.dart
|
| index af088f846434d415523be11d13d2aaef0ef8bb14..526c2ba6a5ef1c7bcd6123162a68a664c4562a87 100644
|
| --- a/sky/sdk/lib/widgets/animated_component.dart
|
| +++ b/sky/sdk/lib/widgets/animated_component.dart
|
| @@ -23,9 +23,10 @@ abstract class AnimatedComponent extends StatefulComponent {
|
|
|
| void syncFields(AnimatedComponent source) { }
|
|
|
| - List<_AnimationEntry> _animatedFields = new List<_AnimationEntry>();
|
| + final List<_AnimationEntry> _animatedFields = new List<_AnimationEntry>();
|
| + final List<AnimationPerformance> _watchedPerformances = new List<AnimationPerformance>();
|
|
|
| - watch(AnimatedValue value) {
|
| + void watch(AnimatedValue value) {
|
| assert(!mounted);
|
| // TODO(ianh): we really should assert that we're not doing this
|
| // in the constructor since doing it there is pointless and
|
| @@ -35,12 +36,22 @@ abstract class AnimatedComponent extends StatefulComponent {
|
| _animatedFields.add(new _AnimationEntry(value));
|
| }
|
|
|
| + void watchPerformance(AnimationPerformance performance) {
|
| + assert(!mounted);
|
| + assert(!_watchedPerformances.contains(performance));
|
| + _watchedPerformances.add(performance);
|
| + }
|
| +
|
| void didMount() {
|
| for (_AnimationEntry entry in _animatedFields) {
|
| entry.subscription = entry.value.onValueChanged.listen((_) {
|
| scheduleBuild();
|
| });
|
| }
|
| +
|
| + for (AnimationPerformance performance in _watchedPerformances)
|
| + performance.addListener(scheduleBuild);
|
| +
|
| super.didMount();
|
| }
|
|
|
| @@ -50,6 +61,10 @@ abstract class AnimatedComponent extends StatefulComponent {
|
| entry.subscription.cancel();
|
| entry.subscription = null;
|
| }
|
| +
|
| + for (AnimationPerformance performance in _watchedPerformances)
|
| + performance.removeListener(scheduleBuild);
|
| +
|
| super.didUnmount();
|
| }
|
|
|
|
|