Chromium Code Reviews| 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:sky' as sky; | 5 import 'dart:sky' as sky; |
| 6 | 6 |
| 7 import 'package:sky/widgets/basic.dart'; | |
| 7 import 'package:sky/widgets/checkbox.dart'; | 8 import 'package:sky/widgets/checkbox.dart'; |
| 9 import 'package:sky/widgets/popup_menu_item.dart'; | |
| 8 import 'package:sky/widgets/popup_menu.dart'; | 10 import 'package:sky/widgets/popup_menu.dart'; |
| 9 import 'package:sky/widgets/basic.dart'; | |
| 10 | 11 |
| 11 export 'package:sky/widgets/popup_menu.dart' show PopupMenuStatus; | 12 export 'package:sky/widgets/popup_menu.dart' show PopupMenuStatus; |
| 12 | 13 |
| 13 class StockMenu extends Component { | 14 class StockMenu extends Component { |
| 14 StockMenu({ | 15 StockMenu({ |
| 15 String key, | 16 String key, |
| 16 this.showing, | 17 this.showing, |
| 17 this.onStatusChanged, | 18 this.onStatusChanged, |
| 18 this.autorefresh: false, | 19 this.autorefresh: false, |
| 19 this.onAutorefreshChanged | 20 this.onAutorefreshChanged |
| 20 }) : super(key: key); | 21 }) : super(key: key); |
| 21 | 22 |
| 22 bool showing; | 23 bool showing; |
| 23 PopupMenuStatusChangedCallback onStatusChanged; | 24 PopupMenuStatusChangedCallback onStatusChanged; |
| 24 final bool autorefresh; | 25 final bool autorefresh; |
| 25 final ValueChanged onAutorefreshChanged; | 26 final ValueChanged onAutorefreshChanged; |
| 26 | 27 |
| 27 Widget build() { | 28 Widget build() { |
| 28 var checkbox = new Checkbox( | 29 var checkbox = new Checkbox( |
| 29 value: this.autorefresh, | 30 value: this.autorefresh, |
| 30 onChanged: this.onAutorefreshChanged | 31 onChanged: this.onAutorefreshChanged |
| 31 ); | 32 ); |
| 32 | 33 |
| 33 return new Positioned( | 34 return new Positioned( |
| 34 child: new PopupMenu( | 35 child: new PopupMenu( |
| 35 items: [ | 36 items: [ |
| 36 new Text('Add stock'), | 37 new PopupMenuItem(child: new Text('Add stock')), |
|
Hixie
2015/07/14 17:57:54
should we have a PopupMenuItem.text('Add stock') c
| |
| 37 new Text('Remove stock'), | 38 new PopupMenuItem(child: new Text('Remove stock')), |
| 38 new Flex([new Flexible(child: new Text('Autorefresh')), checkbox]), | 39 new PopupMenuItem(child: new Flex([new Flexible(child: new Text('Autor efresh')), checkbox])), |
| 39 ], | 40 ], |
| 40 level: 4, | 41 level: 4, |
| 41 showing: showing, | 42 showing: showing, |
| 42 onStatusChanged: onStatusChanged | 43 onStatusChanged: onStatusChanged |
| 43 ), | 44 ), |
| 44 right: sky.view.paddingRight, | 45 right: sky.view.paddingRight, |
| 45 top: sky.view.paddingTop | 46 top: sky.view.paddingTop |
| 46 ); | 47 ); |
| 47 } | 48 } |
| 48 } | 49 } |
| OLD | NEW |