| 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 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 import 'package:vector_math/vector_math.dart'; | 8 import 'package:vector_math/vector_math.dart'; |
| 9 | 9 |
| 10 import '../framework/animation/animated_value.dart'; | 10 import '../framework/animation/animated_value.dart'; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 String key, | 112 String key, |
| 113 this.controller, | 113 this.controller, |
| 114 this.children, | 114 this.children, |
| 115 this.level: 0 | 115 this.level: 0 |
| 116 }) : super(key: key) { | 116 }) : super(key: key) { |
| 117 animate(controller.position, (double value) { | 117 animate(controller.position, (double value) { |
| 118 _position = value; | 118 _position = value; |
| 119 }); | 119 }); |
| 120 } | 120 } |
| 121 | 121 |
| 122 List<UINode> children; | 122 List<Widget> children; |
| 123 int level; | 123 int level; |
| 124 DrawerController controller; | 124 DrawerController controller; |
| 125 | 125 |
| 126 void syncFields(Drawer source) { | 126 void syncFields(Drawer source) { |
| 127 children = source.children; | 127 children = source.children; |
| 128 level = source.level; | 128 level = source.level; |
| 129 controller = source.controller; | 129 controller = source.controller; |
| 130 super.syncFields(source); | 130 super.syncFields(source); |
| 131 } | 131 } |
| 132 | 132 |
| 133 double _position; | 133 double _position; |
| 134 | 134 |
| 135 UINode build() { | 135 Widget build() { |
| 136 Matrix4 transform = new Matrix4.identity(); | 136 Matrix4 transform = new Matrix4.identity(); |
| 137 transform.translate(_position); | 137 transform.translate(_position); |
| 138 | 138 |
| 139 double scaler = _position / _kWidth + 1; | 139 double scaler = _position / _kWidth + 1; |
| 140 Color maskColor = new Color.fromARGB((0x7F * scaler).floor(), 0, 0, 0); | 140 Color maskColor = new Color.fromARGB((0x7F * scaler).floor(), 0, 0, 0); |
| 141 | 141 |
| 142 var mask = new EventListenerNode( | 142 var mask = new EventListenerNode( |
| 143 new Container(decoration: new BoxDecoration(backgroundColor: maskColor)), | 143 new Container(decoration: new BoxDecoration(backgroundColor: maskColor)), |
| 144 onGestureTap: controller.handleMaskTap, | 144 onGestureTap: controller.handleMaskTap, |
| 145 onGestureFlingStart: controller.handleFlingStart | 145 onGestureFlingStart: controller.handleFlingStart |
| (...skipping 11 matching lines...) Expand all Loading... |
| 157 return new EventListenerNode( | 157 return new EventListenerNode( |
| 158 new Stack([ mask, content ]), | 158 new Stack([ mask, content ]), |
| 159 onPointerDown: controller.handlePointerDown, | 159 onPointerDown: controller.handlePointerDown, |
| 160 onPointerMove: controller.handlePointerMove, | 160 onPointerMove: controller.handlePointerMove, |
| 161 onPointerUp: controller.handlePointerUp, | 161 onPointerUp: controller.handlePointerUp, |
| 162 onPointerCancel: controller.handlePointerCancel | 162 onPointerCancel: controller.handlePointerCancel |
| 163 ); | 163 ); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } | 166 } |
| OLD | NEW |