| 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 'animated_component.dart'; | 5 import 'animated_component.dart'; |
| 6 import '../animation/animated_value.dart'; | 6 import '../animation/animated_value.dart'; |
| 7 import '../animation/curves.dart'; | 7 import '../animation/curves.dart'; |
| 8 import '../fn.dart'; | 8 import '../fn.dart'; |
| 9 import '../theme/colors.dart'; | 9 import '../theme/colors.dart'; |
| 10 import '../theme/shadows.dart'; | 10 import '../theme/shadows.dart'; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 double targetPosition = direction < 0.0 ? -_kWidth : 0.0; | 70 double targetPosition = direction < 0.0 ? -_kWidth : 0.0; |
| 71 double distance = (targetPosition - position.value).abs(); | 71 double distance = (targetPosition - position.value).abs(); |
| 72 double duration = distance / velocityX; | 72 double duration = distance / velocityX; |
| 73 | 73 |
| 74 position.animateTo(targetPosition, duration, curve: linear); | 74 position.animateTo(targetPosition, duration, curve: linear); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 class Drawer extends AnimatedComponent { | 78 class Drawer extends AnimatedComponent { |
| 79 // TODO(abarth): We need a better way to become a container for absolutely |
| 80 // positioned elements. |
| 79 static final Style _style = new Style(''' | 81 static final Style _style = new Style(''' |
| 80 position: absolute; | 82 transform: translateX(0);'''); |
| 81 top: 0; | |
| 82 left: 0; | |
| 83 bottom: 0; | |
| 84 right: 0;''' | |
| 85 ); | |
| 86 | 83 |
| 87 static final Style _maskStyle = new Style(''' | 84 static final Style _maskStyle = new Style(''' |
| 88 background-color: black; | 85 background-color: black; |
| 89 will-change: opacity; | 86 will-change: opacity; |
| 90 position: absolute; | 87 position: absolute; |
| 91 top: 0; | 88 top: 0; |
| 92 left: 0; | 89 left: 0; |
| 93 bottom: 0; | 90 bottom: 0; |
| 94 right: 0;''' | 91 right: 0;''' |
| 95 ); | 92 ); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 inlineStyle: inlineStyle, | 146 inlineStyle: inlineStyle, |
| 150 children: [ mask, content ] | 147 children: [ mask, content ] |
| 151 ), | 148 ), |
| 152 onPointerDown: controller.handlePointerDown, | 149 onPointerDown: controller.handlePointerDown, |
| 153 onPointerMove: controller.handlePointerMove, | 150 onPointerMove: controller.handlePointerMove, |
| 154 onPointerUp: controller.handlePointerUp, | 151 onPointerUp: controller.handlePointerUp, |
| 155 onPointerCancel: controller.handlePointerCancel | 152 onPointerCancel: controller.handlePointerCancel |
| 156 ); | 153 ); |
| 157 } | 154 } |
| 158 } | 155 } |
| OLD | NEW |