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

Unified Diff: sky/sdk/lib/widgets/animated_component.dart

Issue 1232473003: Delete AnimationValue (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « sky/sdk/lib/animation/generators.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8747283a8f0c7e30ad15d58de17282cbaa3757d0..7793743b16ee5e5b31240a07777b78c3f6f8199f 100644
--- a/sky/sdk/lib/widgets/animated_component.dart
+++ b/sky/sdk/lib/widgets/animated_component.dart
@@ -2,37 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'dart:async';
-
-import '../animation/animated_value.dart';
import '../animation/animation_performance.dart';
import 'basic.dart';
-class _AnimationEntry {
- _AnimationEntry(this.value);
- final AnimatedValue value;
- StreamSubscription<double> subscription;
-}
-
abstract class AnimatedComponent extends StatefulComponent {
AnimatedComponent({ String key }) : super(key: key);
void syncFields(AnimatedComponent source) { }
- final List<_AnimationEntry> _animatedFields = new List<_AnimationEntry>();
final List<AnimationPerformance> _watchedPerformances = new List<AnimationPerformance>();
- void watch(AnimatedValue value) {
- // TODO(ianh): we really should assert that we're not doing this
- // in the constructor since doing it there is pointless and
- // expensive, since we'll be doing it for every copy of the object
- // even though only the first one will use it (since we're
- // stateful, the others will all be discarded early).
- assert(!mounted);
- _animatedFields.add(new _AnimationEntry(value));
- }
-
void watchPerformance(AnimationPerformance performance) {
assert(!_watchedPerformances.contains(performance));
_watchedPerformances.add(performance);
@@ -41,28 +21,14 @@ abstract class AnimatedComponent extends StatefulComponent {
}
void didMount() {
- for (_AnimationEntry entry in _animatedFields) {
- entry.subscription = entry.value.onValueChanged.listen((_) {
- scheduleBuild();
- });
- }
-
for (AnimationPerformance performance in _watchedPerformances)
performance.addListener(scheduleBuild);
-
super.didMount();
}
void didUnmount() {
- for (_AnimationEntry entry in _animatedFields) {
- assert(entry.subscription != null);
- entry.subscription.cancel();
- entry.subscription = null;
- }
-
for (AnimationPerformance performance in _watchedPerformances)
performance.removeListener(scheduleBuild);
-
super.didUnmount();
}
« no previous file with comments | « sky/sdk/lib/animation/generators.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698