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

Side by Side Diff: sky/sdk/lib/framework/components2/drawer.dart

Issue 1171273002: Move AnimatedComponent away from mirrors and towards a callback-based setter. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
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 '../animation/curves.dart'; 6 import '../animation/curves.dart';
7 import '../fn2.dart'; 7 import '../fn2.dart';
8 import '../theme2/colors.dart'; 8 import '../theme2/colors.dart';
9 import '../theme2/shadows.dart'; 9 import '../theme2/shadows.dart';
10 import 'animated_component.dart'; 10 import 'animated_component.dart';
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DrawerController controller; 97 DrawerController controller;
98 98
99 double _position; 99 double _position;
100 100
101 Drawer({ 101 Drawer({
102 Object key, 102 Object key,
103 this.controller, 103 this.controller,
104 this.children, 104 this.children,
105 this.level: 0 105 this.level: 0
106 }) : super(key: key) { 106 }) : super(key: key) {
107 animateField(controller.position, #_position); 107 animate(controller.position, (double value) {
108 _position = value;
109 });
108 } 110 }
109 111
110 UINode build() { 112 UINode build() {
111 Matrix4 transform = new Matrix4.identity(); 113 Matrix4 transform = new Matrix4.identity();
112 transform.translate(_position); 114 transform.translate(_position);
113 115
114 double scaler = _position / _kWidth + 1; 116 double scaler = _position / _kWidth + 1;
115 Color maskColor = new Color.fromARGB((0x7F * scaler).floor(), 0, 0, 0); 117 Color maskColor = new Color.fromARGB((0x7F * scaler).floor(), 0, 0, 0);
116 118
117 var mask = new EventListenerNode( 119 var mask = new EventListenerNode(
(...skipping 15 matching lines...) Expand all
133 new StackContainer( 135 new StackContainer(
134 children: [ mask, content ] 136 children: [ mask, content ]
135 ), 137 ),
136 onPointerDown: controller.handlePointerDown, 138 onPointerDown: controller.handlePointerDown,
137 onPointerMove: controller.handlePointerMove, 139 onPointerMove: controller.handlePointerMove,
138 onPointerUp: controller.handlePointerUp, 140 onPointerUp: controller.handlePointerUp,
139 onPointerCancel: controller.handlePointerCancel 141 onPointerCancel: controller.handlePointerCancel
140 ); 142 );
141 } 143 }
142 } 144 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/animated_component.dart ('k') | sky/sdk/lib/framework/components2/popup_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698