| 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 '../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 22 matching lines...) Expand all Loading... |
| 33 void _checkValue() { | 33 void _checkValue() { |
| 34 var newClosedState = isClosed; | 34 var newClosedState = isClosed; |
| 35 if (onStatusChange != null && _oldClosedState != newClosedState) { | 35 if (onStatusChange != null && _oldClosedState != newClosedState) { |
| 36 onStatusChange(!newClosedState); | 36 onStatusChange(!newClosedState); |
| 37 _oldClosedState = newClosedState; | 37 _oldClosedState = newClosedState; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool get isClosed => position.value == -_kWidth; | 41 bool get isClosed => position.value == -_kWidth; |
| 42 bool get _isMostlyClosed => position.value <= -_kWidth / 2; | 42 bool get _isMostlyClosed => position.value <= -_kWidth / 2; |
| 43 void toggle(_) => _isMostlyClosed ? _open() : _close(); | 43 void toggle() => _isMostlyClosed ? _open() : _close(); |
| 44 | 44 |
| 45 void handleMaskTap(_) => _close(); | 45 void handleMaskTap(_) => _close(); |
| 46 void handlePointerDown(_) => position.stop(); | 46 void handlePointerDown(_) => position.stop(); |
| 47 | 47 |
| 48 void handlePointerMove(sky.PointerEvent event) { | 48 void handlePointerMove(sky.PointerEvent event) { |
| 49 if (position.isAnimating) | 49 if (position.isAnimating) |
| 50 return; | 50 return; |
| 51 position.value = math.min(0.0, math.max(position.value + event.dx, -_kWidth)
); | 51 position.value = math.min(0.0, math.max(position.value + event.dx, -_kWidth)
); |
| 52 } | 52 } |
| 53 | 53 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 new StackContainer( | 133 new StackContainer( |
| 134 children: [ mask, content ] | 134 children: [ mask, content ] |
| 135 ), | 135 ), |
| 136 onPointerDown: controller.handlePointerDown, | 136 onPointerDown: controller.handlePointerDown, |
| 137 onPointerMove: controller.handlePointerMove, | 137 onPointerMove: controller.handlePointerMove, |
| 138 onPointerUp: controller.handlePointerUp, | 138 onPointerUp: controller.handlePointerUp, |
| 139 onPointerCancel: controller.handlePointerCancel | 139 onPointerCancel: controller.handlePointerCancel |
| 140 ); | 140 ); |
| 141 } | 141 } |
| 142 } | 142 } |
| OLD | NEW |