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