Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: sky/framework/animation/animated_value.dart

Issue 1027633003: [Effen] Add AnimatedComponent base class (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cr changes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/framework/components/animated_component.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/animation/animated_value.dart
diff --git a/sky/framework/animation/animated_value.dart b/sky/framework/animation/animated_value.dart
index faf17b6a82b901a7bc9e3d45253a3cfa0cf36cf6..0db6f90da0302976452fb51998199bffef52f332 100644
--- a/sky/framework/animation/animated_value.dart
+++ b/sky/framework/animation/animated_value.dart
@@ -13,9 +13,12 @@ class AnimatedValue {
double _value;
AnimatedValue(double initial) {
- value = initial;
+ _value = initial;
}
+ // A stream of change in value from |initial|. The stream does not
+ // contain the initial value. Consumers should check the initial value via
+ // the |value| accessor.
Stream<double> get onValueChanged => _controller.stream;
double get value => _value;
@@ -55,28 +58,3 @@ class AnimatedValue {
});
}
}
-
-class AnimatedValueListener {
- final Component _component;
- final AnimatedValue _value;
- StreamSubscription<double> _subscription;
-
- AnimatedValueListener(this._component, this._value);
-
- double get value => _value == null ? null : _value.value;
-
- void ensureListening() {
- if (_subscription != null || _value == null)
- return;
- _subscription = _value.onValueChanged.listen((_) {
- _component.scheduleBuild();
- });
- }
-
- void stopListening() {
- if (_subscription == null)
- return;
- _subscription.cancel();
- _subscription = null;
- }
-}
« no previous file with comments | « no previous file | sky/framework/components/animated_component.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698