| 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 '../fn2.dart'; | 6 import '../fn2.dart'; |
| 7 import '../theme2/colors.dart'; | 7 import '../theme2/colors.dart'; |
| 8 import '../theme2/shadows.dart'; | 8 import '../theme2/shadows.dart'; |
| 9 import 'animated_component.dart'; | 9 import 'animated_component.dart'; |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 List<List<UINode>> items; | 54 List<List<UINode>> items; |
| 55 int level; | 55 int level; |
| 56 PopupMenuController controller; | 56 PopupMenuController controller; |
| 57 | 57 |
| 58 double _position; | 58 double _position; |
| 59 // int _width; | 59 // int _width; |
| 60 // int _height; | 60 // int _height; |
| 61 | 61 |
| 62 PopupMenu({ Object key, this.controller, this.items, this.level }) | 62 PopupMenu({ Object key, this.controller, this.items, this.level }) |
| 63 : super(key: key) { | 63 : super(key: key) { |
| 64 animateField(controller.position, #_position); | 64 animate(controller.position, (double value) { |
| 65 _position = value; |
| 66 }); |
| 65 // onDidMount(_measureSize); | 67 // onDidMount(_measureSize); |
| 66 } | 68 } |
| 67 | 69 |
| 68 double _opacityFor(int i) { | 70 double _opacityFor(int i) { |
| 69 if (_position == null || _position == 1.0) | 71 if (_position == null || _position == 1.0) |
| 70 return null; | 72 return null; |
| 71 double unit = 1.0 / items.length; | 73 double unit = 1.0 / items.length; |
| 72 double duration = 1.5 * unit; | 74 double duration = 1.5 * unit; |
| 73 double start = i * unit; | 75 double start = i * unit; |
| 74 return math.max(0.0, math.min(1.0, (_position - start) / duration)); | 76 return math.max(0.0, math.min(1.0, (_position - start) / duration)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 105 padding: const EdgeDims.all(8.0), | 107 padding: const EdgeDims.all(8.0), |
| 106 decoration: new BoxDecoration( | 108 decoration: new BoxDecoration( |
| 107 backgroundColor: Grey[50], | 109 backgroundColor: Grey[50], |
| 108 borderRadius: 2.0, | 110 borderRadius: 2.0, |
| 109 boxShadow: Shadow[level]), | 111 boxShadow: Shadow[level]), |
| 110 child: new BlockContainer(children: children) | 112 child: new BlockContainer(children: children) |
| 111 ) | 113 ) |
| 112 ); | 114 ); |
| 113 } | 115 } |
| 114 } | 116 } |
| OLD | NEW |