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:async'; | 5 import 'dart:async'; |
6 import 'dart:math' as math; | 6 import 'dart:math' as math; |
7 import 'dart:sky' as sky; | 7 import 'dart:sky' as sky; |
8 | 8 |
9 import '../animation/animated_value.dart'; | 9 import '../animation/animated_value.dart'; |
10 import '../painting/box_painter.dart'; | 10 import '../painting/box_painter.dart'; |
11 import '../theme2/colors.dart'; | 11 import '../theme2/colors.dart'; |
12 import '../theme2/shadows.dart'; | 12 import '../theme2/shadows.dart'; |
13 import 'animated_component.dart'; | 13 import 'animated_component.dart'; |
14 import 'material.dart'; | |
15 import 'popup_menu_item.dart'; | 14 import 'popup_menu_item.dart'; |
16 import 'wrappers.dart'; | 15 import 'wrappers.dart'; |
17 | 16 |
18 const double _kMenuOpenDuration = 300.0; | 17 const double _kMenuOpenDuration = 300.0; |
19 const double _kMenuCloseDuration = 200.0; | 18 const double _kMenuCloseDuration = 200.0; |
20 const double _kMenuCloseDelay = 100.0; | 19 const double _kMenuCloseDelay = 100.0; |
21 | 20 |
22 enum MenuState { hidden, opening, open, closing } | 21 enum MenuState { hidden, opening, open, closing } |
23 | 22 |
24 class PopupMenuController { | 23 class PopupMenuController { |
(...skipping 28 matching lines...) Expand all Loading... |
53 } | 52 } |
54 } | 53 } |
55 | 54 |
56 class PopupMenu extends AnimatedComponent { | 55 class PopupMenu extends AnimatedComponent { |
57 | 56 |
58 PopupMenu({ Object key, this.controller, this.items, this.level }) | 57 PopupMenu({ Object key, this.controller, this.items, this.level }) |
59 : super(key: key) { | 58 : super(key: key) { |
60 _painter = new BoxPainter(new BoxDecoration( | 59 _painter = new BoxPainter(new BoxDecoration( |
61 backgroundColor: Grey[50], | 60 backgroundColor: Grey[50], |
62 borderRadius: 2.0, | 61 borderRadius: 2.0, |
63 boxShadow: Shadow[level])); | 62 boxShadow: shadows[level])); |
64 | 63 |
65 animate(controller.position, (double value) { | 64 animate(controller.position, (double value) { |
66 _position = value; | 65 _position = value; |
67 }); | 66 }); |
68 } | 67 } |
69 | 68 |
70 PopupMenuController controller; | 69 PopupMenuController controller; |
71 List<List<UINode>> items; | 70 List<List<UINode>> items; |
72 int level; | 71 int level; |
73 | 72 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 child: new Container( | 109 child: new Container( |
111 padding: const EdgeDims.all(8.0), | 110 padding: const EdgeDims.all(8.0), |
112 child: new Block(children) | 111 child: new Block(children) |
113 ) | 112 ) |
114 ) | 113 ) |
115 ) | 114 ) |
116 ); | 115 ); |
117 } | 116 } |
118 | 117 |
119 } | 118 } |
OLD | NEW |