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 'package:sky/framework/fn2.dart'; | 5 import 'package:sky/framework/fn2.dart'; |
6 import 'package:sky/framework/components2/popup_menu.dart'; | 6 import 'package:sky/framework/components2/popup_menu.dart'; |
7 import 'package:sky/framework/components2/checkbox.dart'; | 7 import 'package:sky/framework/components2/checkbox.dart'; |
8 import 'package:sky/framework/theme/view_configuration.dart'; | 8 import 'package:sky/framework/theme/view_configuration.dart'; |
9 | 9 |
10 class StockMenu extends Component { | 10 class StockMenu extends Component { |
11 PopupMenuController controller; | |
12 | 11 |
13 StockMenu({Object key, this.controller, this.autorefresh: false, this.onAutore
freshChanged}) : super(key: key); | 12 StockMenu({Object key, this.controller, this.autorefresh: false, this.onAutore
freshChanged}) : super(key: key); |
14 | 13 |
15 final bool autorefresh; | 14 PopupMenuController controller; |
16 final ValueChanged onAutorefreshChanged; | 15 bool autorefresh; |
| 16 ValueChanged onAutorefreshChanged; |
| 17 |
| 18 void syncFields(StockMenu source) { |
| 19 controller = source.controller; |
| 20 autorefresh = source.autorefresh; |
| 21 onAutorefreshChanged = source.onAutorefreshChanged; |
| 22 super.syncFields(source); |
| 23 } |
17 | 24 |
18 UINode build() { | 25 UINode build() { |
19 var checkbox = new Checkbox( | 26 var checkbox = new Checkbox( |
20 checked: this.autorefresh, | 27 checked: this.autorefresh, |
21 onChanged: this.onAutorefreshChanged | 28 onChanged: this.onAutorefreshChanged |
22 ); | 29 ); |
23 | 30 |
24 return new StackPositionedChild( | 31 return new StackPositionedChild( |
25 new PopupMenu( | 32 new PopupMenu( |
26 controller: controller, | 33 controller: controller, |
27 items: [ | 34 items: [ |
28 [new Text('Add stock')], | 35 [new Text('Add stock')], |
29 [new Text('Remove stock')], | 36 [new Text('Remove stock')], |
30 // [new FlexExpandingChild(new Text('Autorefresh')), checkbox], | 37 // [new FlexExpandingChild(new Text('Autorefresh')), checkbox], |
31 ], | 38 ], |
32 level: 4 | 39 level: 4 |
33 ), | 40 ), |
34 right: 8.0, | 41 right: 8.0, |
35 top: 8.0 + kStatusBarHeight | 42 top: 8.0 + kStatusBarHeight |
36 ); | 43 ); |
37 } | 44 } |
38 } | 45 } |
OLD | NEW |