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 42 matching lines...) Loading... |
53 class PopupMenu extends AnimatedComponent { | 53 class PopupMenu extends AnimatedComponent { |
54 | 54 |
55 PopupMenu({ Object key, this.controller, this.items, this.level }) | 55 PopupMenu({ Object key, this.controller, this.items, this.level }) |
56 : super(key: key) { | 56 : super(key: key) { |
57 animate(controller.position, (double value) { | 57 animate(controller.position, (double value) { |
58 _position = value; | 58 _position = value; |
59 }); | 59 }); |
60 // onDidMount(_measureSize); | 60 // onDidMount(_measureSize); |
61 } | 61 } |
62 | 62 |
| 63 PopupMenuController controller; |
63 List<List<UINode>> items; | 64 List<List<UINode>> items; |
64 int level; | 65 int level; |
65 PopupMenuController controller; | 66 |
| 67 void syncFields(PopupMenu source) { |
| 68 controller = source.controller; |
| 69 items = source.items; |
| 70 level = source.level; |
| 71 super.syncFields(source); |
| 72 } |
66 | 73 |
67 double _position; | 74 double _position; |
68 // int _width; | 75 // int _width; |
69 // int _height; | 76 // int _height; |
70 | 77 |
71 double _opacityFor(int i) { | 78 double _opacityFor(int i) { |
72 if (_position == null || _position == 1.0) | 79 if (_position == null || _position == 1.0) |
73 return null; | 80 return null; |
74 double unit = 1.0 / items.length; | 81 double unit = 1.0 / items.length; |
75 double duration = 1.5 * unit; | 82 double duration = 1.5 * unit; |
(...skipping 33 matching lines...) Loading... |
109 decoration: new BoxDecoration( | 116 decoration: new BoxDecoration( |
110 backgroundColor: Grey[50], | 117 backgroundColor: Grey[50], |
111 borderRadius: 2.0, | 118 borderRadius: 2.0, |
112 boxShadow: Shadow[level]), | 119 boxShadow: Shadow[level]), |
113 child: new BlockContainer(children: children) | 120 child: new BlockContainer(children: children) |
114 ) | 121 ) |
115 ); | 122 ); |
116 } | 123 } |
117 | 124 |
118 } | 125 } |
OLD | NEW |