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