| Index: sky/sdk/lib/framework/components2/animated_component.dart
|
| diff --git a/sky/sdk/lib/framework/components2/animated_component.dart b/sky/sdk/lib/framework/components2/animated_component.dart
|
| index 79aabef0e08cc9ad7dfab02ea28e3717c59da8c0..d1dada90dbfeab2f8efe483c34c8bcdb11e334fe 100644
|
| --- a/sky/sdk/lib/framework/components2/animated_component.dart
|
| +++ b/sky/sdk/lib/framework/components2/animated_component.dart
|
| @@ -4,32 +4,23 @@
|
|
|
| import '../animation/animated_value.dart';
|
| import '../fn2.dart';
|
| -import 'dart:mirrors';
|
| +import 'dart:async';
|
|
|
| -abstract class AnimatedComponent extends Component {
|
| - AnimatedComponent({ Object key }) : super(key: key, stateful: true);
|
| -
|
| - var _debugAnimatedFields = new Set<Symbol>();
|
| - bool _debugIsNotYetAnimated(Symbol s) {
|
| - return _debugAnimatedFields.add(s);
|
| - }
|
| +typedef void SetterFunction(double value);
|
|
|
| - animateField(AnimatedValue value, Symbol symbol) {
|
| - // TODO(rafaelw): Assert symbol is present on |this|, is private and
|
| - // is over the same parameterized type as the animated value.
|
| - var mirror = reflect(this);
|
| - var subscription;
|
| +abstract class AnimatedComponent extends Component {
|
|
|
| - assert(_debugIsNotYetAnimated(symbol));
|
| - mirror.setField(symbol, value.value);
|
| + AnimatedComponent({ Object key }) : super(key: key, stateful: true);
|
|
|
| + animate(AnimatedValue value, SetterFunction setter) {
|
| + setter(value.value);
|
| + StreamSubscription<double> subscription;
|
| onDidMount(() {
|
| subscription = value.onValueChanged.listen((_) {
|
| - mirror.setField(symbol, value.value);
|
| + setter(value.value);
|
| scheduleBuild();
|
| });
|
| });
|
| -
|
| onDidUnmount(() {
|
| if (subscription != null) {
|
| subscription.cancel();
|
| @@ -37,4 +28,5 @@ abstract class AnimatedComponent extends Component {
|
| }
|
| });
|
| }
|
| +
|
| }
|
|
|