| 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 'package:sky/animation/animation_performance.dart'; | 9 import 'package:sky/animation/animation_performance.dart'; |
| 10 import 'package:sky/painting/box_painter.dart'; | 10 import 'package:sky/painting/box_painter.dart'; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 assert(_closeTimer == null); | 84 assert(_closeTimer == null); |
| 85 _closeTimer = new Timer(_kMenuCloseDelay, performance.reverse); | 85 _closeTimer = new Timer(_kMenuCloseDelay, performance.reverse); |
| 86 | 86 |
| 87 return _closeCompleter.future; | 87 return _closeCompleter.future; |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 class PopupMenu extends AnimatedComponent { | 91 class PopupMenu extends AnimatedComponent { |
| 92 | 92 |
| 93 PopupMenu({ String key, this.controller, this.items, this.level }) | 93 PopupMenu({ String key, this.controller, this.items, this.level }) |
| 94 : super(key: key) { | 94 : super(key: key); |
| 95 _painter = new BoxPainter(new BoxDecoration( | |
| 96 backgroundColor: Grey[50], | |
| 97 borderRadius: 2.0, | |
| 98 boxShadow: shadows[level])); | |
| 99 watchPerformance(controller.performance); | |
| 100 } | |
| 101 | 95 |
| 102 PopupMenuController controller; | 96 PopupMenuController controller; |
| 103 List<PopupMenuItem> items; | 97 List<PopupMenuItem> items; |
| 104 int level; | 98 int level; |
| 105 | 99 |
| 100 void initState() { |
| 101 _painter = new BoxPainter(new BoxDecoration( |
| 102 backgroundColor: Grey[50], |
| 103 borderRadius: 2.0, |
| 104 boxShadow: shadows[level])); |
| 105 watch(controller.performance); |
| 106 } |
| 107 |
| 106 void syncFields(PopupMenu source) { | 108 void syncFields(PopupMenu source) { |
| 107 controller = source.controller; | 109 controller = source.controller; |
| 108 items = source.items; | 110 items = source.items; |
| 109 level = source.level; | 111 level = source.level; |
| 110 _painter = source._painter; | 112 _painter = source._painter; |
| 111 super.syncFields(source); | 113 super.syncFields(source); |
| 112 } | 114 } |
| 113 | 115 |
| 114 BoxPainter _painter; | 116 BoxPainter _painter; |
| 115 | 117 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 ) | 159 ) |
| 158 ) | 160 ) |
| 159 ) | 161 ) |
| 160 ) | 162 ) |
| 161 ) | 163 ) |
| 162 ) | 164 ) |
| 163 ); | 165 ); |
| 164 } | 166 } |
| 165 | 167 |
| 166 } | 168 } |
| OLD | NEW |