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/animation_performance.dart'; | 9 import '../animation/animation_performance.dart'; |
10 import '../painting/box_painter.dart'; | 10 import '../painting/box_painter.dart'; |
11 import '../theme/colors.dart'; | 11 import '../theme/colors.dart'; |
12 import '../theme/shadows.dart'; | 12 import '../theme/shadows.dart'; |
13 import 'animated_component.dart'; | 13 import 'animated_component.dart'; |
14 import 'basic.dart'; | 14 import 'basic.dart'; |
15 import 'popup_menu_item.dart'; | 15 import 'popup_menu_item.dart'; |
| 16 import 'scrollable_viewport.dart'; |
16 | 17 |
17 const Duration _kMenuOpenDuration = const Duration(milliseconds: 300); | 18 const Duration _kMenuOpenDuration = const Duration(milliseconds: 300); |
18 const Duration _kMenuCloseDuration = const Duration(milliseconds: 200); | 19 const Duration _kMenuCloseDuration = const Duration(milliseconds: 200); |
19 const Duration _kMenuCloseDelay = const Duration(milliseconds: 100); | 20 const Duration _kMenuCloseDelay = const Duration(milliseconds: 100); |
20 const double _kMenuWidthStep = 56.0; | 21 const double _kMenuWidthStep = 56.0; |
21 const double _kMenuMargin = 16.0; // 24.0 on tablet | 22 const double _kMenuMargin = 16.0; // 24.0 on tablet |
22 const double _kMenuMinWidth = 2.0 * _kMenuWidthStep; | 23 const double _kMenuMinWidth = 2.0 * _kMenuWidthStep; |
23 const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep; | 24 const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep; |
24 const double _kMenuHorizontalPadding = 16.0; | 25 const double _kMenuHorizontalPadding = 16.0; |
25 const double _kMenuVerticalPadding = 8.0; | 26 const double _kMenuVerticalPadding = 8.0; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 double height = math.min(size.height, size.height * controller.posit
ion.value * 1.5); | 140 double height = math.min(size.height, size.height * controller.posit
ion.value * 1.5); |
140 _painter.paint(canvas, new Rect.fromLTRB(size.width - width, 0.0, wi
dth, height)); | 141 _painter.paint(canvas, new Rect.fromLTRB(size.width - width, 0.0, wi
dth, height)); |
141 }, | 142 }, |
142 child: new ConstrainedBox( | 143 child: new ConstrainedBox( |
143 constraints: new BoxConstraints( | 144 constraints: new BoxConstraints( |
144 minWidth: _kMenuMinWidth, | 145 minWidth: _kMenuMinWidth, |
145 maxWidth: _kMenuMaxWidth | 146 maxWidth: _kMenuMaxWidth |
146 ), | 147 ), |
147 child: new ShrinkWrapWidth( | 148 child: new ShrinkWrapWidth( |
148 stepWidth: _kMenuWidthStep, | 149 stepWidth: _kMenuWidthStep, |
149 child: new Container( | 150 child: new ScrollableViewport( |
150 padding: const EdgeDims.symmetric( | 151 child: new Container( |
151 horizontal: _kMenuHorizontalPadding, | 152 padding: const EdgeDims.symmetric( |
152 vertical: _kMenuVerticalPadding | 153 horizontal: _kMenuHorizontalPadding, |
153 ), | 154 vertical: _kMenuVerticalPadding |
154 child: new Block(children) | 155 ), |
| 156 child: new Block(children) |
| 157 ) |
155 ) | 158 ) |
156 ) | 159 ) |
157 ) | 160 ) |
158 ) | 161 ) |
159 ) | 162 ) |
160 ); | 163 ); |
161 } | 164 } |
162 | 165 |
163 } | 166 } |
OLD | NEW |