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

Side by Side Diff: sky/framework/components/animated_component.dart

Issue 1126333006: [Effen] Make the drawer not be included in the build output when the drawer is not shown. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: git cl land Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « sky/framework/animation/animated_value.dart ('k') | sky/framework/components/drawer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import '../animation/animated_value.dart'; 5 import '../animation/animated_value.dart';
6 import '../fn.dart'; 6 import '../fn.dart';
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 8
9 abstract class AnimatedComponent extends Component { 9 abstract class AnimatedComponent extends Component {
10 AnimatedComponent({ Object key }) : super(key: key, stateful: true); 10 AnimatedComponent({ Object key }) : super(key: key, stateful: true);
11 11
12 var _debugAnimatedFields = new Set<Symbol>();
13 bool _debugIsNotYetAnimated(Symbol s) {
14 return _debugAnimatedFields.add(s);
15 }
16
12 animateField(AnimatedValue value, Symbol symbol) { 17 animateField(AnimatedValue value, Symbol symbol) {
13 // TODO(rafaelw): Assert symbol is present on |this|, is private and 18 // TODO(rafaelw): Assert symbol is present on |this|, is private and
14 // is over the same parameterized type as the animated value. 19 // is over the same parameterized type as the animated value.
15 var mirror = reflect(this); 20 var mirror = reflect(this);
16 var subscription; 21 var subscription;
17 22
23 assert(_debugIsNotYetAnimated(symbol));
18 mirror.setField(symbol, value.value); 24 mirror.setField(symbol, value.value);
19 25
20 onDidMount(() { 26 onDidMount(() {
21 subscription = value.onValueChanged.listen((_) { 27 subscription = value.onValueChanged.listen((_) {
22 mirror.setField(symbol, value.value); 28 mirror.setField(symbol, value.value);
23 scheduleBuild(); 29 scheduleBuild();
24 }); 30 });
25 }); 31 });
26 32
27 onDidUnmount(() { 33 onDidUnmount(() {
28 if (subscription != null) { 34 if (subscription != null) {
29 subscription.cancel(); 35 subscription.cancel();
30 subscription = null; 36 subscription = null;
31 } 37 }
32 }); 38 });
33 } 39 }
34 } 40 }
OLDNEW
« no previous file with comments | « sky/framework/animation/animated_value.dart ('k') | sky/framework/components/drawer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698