| 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 'dart:math' as math; | 10 import 'dart:math' as math; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 class Drawer extends AnimatedComponent { | 92 class Drawer extends AnimatedComponent { |
| 93 // TODO(abarth): We need a better way to become a container for absolutely | 93 // TODO(abarth): We need a better way to become a container for absolutely |
| 94 // positioned elements. | 94 // positioned elements. |
| 95 static final Style _style = new Style(''' | 95 static final Style _style = new Style(''' |
| 96 transform: translateX(0);'''); | 96 transform: translateX(0);'''); |
| 97 | 97 |
| 98 static final Style _maskStyle = new Style(''' | 98 static final Style _maskStyle = new Style(''' |
| 99 background-color: black; | 99 background-color: black; |
| 100 will-change: opacity; | 100 will-change: opacity;''' |
| 101 position: absolute; | |
| 102 top: 0; | |
| 103 left: 0; | |
| 104 bottom: 0; | |
| 105 right: 0;''' | |
| 106 ); | 101 ); |
| 107 | 102 |
| 108 static final Style _contentStyle = new Style(''' | 103 static final Style _contentStyle = new Style(''' |
| 109 background-color: ${Grey[50]}; | 104 background-color: ${Grey[50]}; |
| 110 will-change: transform; | 105 will-change: transform; |
| 111 position: absolute; | 106 width: ${_kWidth}px;''' |
| 112 width: ${_kWidth}px; | |
| 113 top: 0; | |
| 114 left: 0; | |
| 115 bottom: 0;''' | |
| 116 ); | 107 ); |
| 117 | 108 |
| 118 List<UINode> children; | 109 List<UINode> children; |
| 119 int level; | 110 int level; |
| 120 DrawerController controller; | 111 DrawerController controller; |
| 121 | 112 |
| 122 double _position; | 113 double _position; |
| 123 | 114 |
| 124 Drawer({ | 115 Drawer({ |
| 125 Object key, | 116 Object key, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 145 | 136 |
| 146 Material content = new Material( | 137 Material content = new Material( |
| 147 content: new Container( | 138 content: new Container( |
| 148 style: _contentStyle, | 139 style: _contentStyle, |
| 149 inlineStyle: contentInlineStyle, | 140 inlineStyle: contentInlineStyle, |
| 150 children: children | 141 children: children |
| 151 ), | 142 ), |
| 152 level: level); | 143 level: level); |
| 153 | 144 |
| 154 return new EventListenerNode( | 145 return new EventListenerNode( |
| 155 new Container( | 146 new FillStackContainer( |
| 156 style: _style, | 147 style: _style, |
| 157 children: [ mask, content ] | 148 children: [ mask, content ] |
| 158 ), | 149 ), |
| 159 onPointerDown: controller.handlePointerDown, | 150 onPointerDown: controller.handlePointerDown, |
| 160 onPointerMove: controller.handlePointerMove, | 151 onPointerMove: controller.handlePointerMove, |
| 161 onPointerUp: controller.handlePointerUp, | 152 onPointerUp: controller.handlePointerUp, |
| 162 onPointerCancel: controller.handlePointerCancel | 153 onPointerCancel: controller.handlePointerCancel |
| 163 ); | 154 ); |
| 164 } | 155 } |
| 165 } | 156 } |
| OLD | NEW |