OLD | NEW |
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 '../theme/colors.dart'; | 8 import '../theme/colors.dart'; |
9 import 'animated_component.dart'; | 9 import 'animated_component.dart'; |
10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 animateField(controller.position, #_position); | 106 animateField(controller.position, #_position); |
107 } | 107 } |
108 | 108 |
109 UINode build() { | 109 UINode build() { |
110 Matrix4 transform = new Matrix4.identity(); | 110 Matrix4 transform = new Matrix4.identity(); |
111 transform.translate(_position); | 111 transform.translate(_position); |
112 | 112 |
113 Color maskColor = new Color(((_position / _kWidth + 1) * 0xFF).floor() << 24
); | 113 Color maskColor = new Color(((_position / _kWidth + 1) * 0xFF).floor() << 24
); |
114 | 114 |
115 var mask = new EventListenerNode( | 115 var mask = new EventListenerNode( |
116 new Container( | 116 new Container(decoration: new BoxDecoration(backgroundColor: maskColor)), |
117 desiredSize: Size.infinite, | |
118 decoration: new BoxDecoration(backgroundColor: maskColor) | |
119 ), | |
120 onGestureTap: controller.handleMaskTap, | 117 onGestureTap: controller.handleMaskTap, |
121 onGestureFlingStart: controller.handleFlingStart | 118 onGestureFlingStart: controller.handleFlingStart |
122 ); | 119 ); |
123 | 120 |
124 Material content = new Material( | 121 Material content = new Material( |
125 content: new Container( | 122 content: new Container( |
126 decoration: new BoxDecoration(backgroundColor: new Color(0xFFFFFFFF)), | 123 decoration: new BoxDecoration(backgroundColor: new Color(0xFFFFFFFF)), |
127 desiredSize: new Size.fromWidth(_kWidth), | 124 width: _kWidth, |
128 transform: transform, | 125 transform: transform, |
129 child: new BlockContainer(children: children) | 126 child: new BlockContainer(children: children) |
130 ), | 127 ), |
131 level: level); | 128 level: level); |
132 | 129 |
133 return new EventListenerNode( | 130 return new EventListenerNode( |
134 new StackContainer( | 131 new StackContainer( |
135 children: [ mask, content ] | 132 children: [ mask, content ] |
136 ), | 133 ), |
137 onPointerDown: controller.handlePointerDown, | 134 onPointerDown: controller.handlePointerDown, |
138 onPointerMove: controller.handlePointerMove, | 135 onPointerMove: controller.handlePointerMove, |
139 onPointerUp: controller.handlePointerUp, | 136 onPointerUp: controller.handlePointerUp, |
140 onPointerCancel: controller.handlePointerCancel | 137 onPointerCancel: controller.handlePointerCancel |
141 ); | 138 ); |
142 } | 139 } |
143 } | 140 } |
OLD | NEW |