Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: sky/examples/stocks/lib/stock_menu.dart

Issue 1134163003: [Effen] Use the checkbox widget in the stocks app. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix tests Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/fn.dart';
6 import 'package:sky/framework/layout.dart';
5 import 'package:sky/framework/components/popup_menu.dart'; 7 import 'package:sky/framework/components/popup_menu.dart';
6 import 'package:sky/framework/fn.dart'; 8 import 'package:sky/framework/components/checkbox.dart';
7 import 'package:sky/framework/theme/view_configuration.dart'; 9 import 'package:sky/framework/theme/view_configuration.dart';
8 10
9 class StockMenu extends Component { 11 class StockMenu extends Component {
10 static final Style _style = new Style(''' 12 static final Style _style = new Style('''
11 position: absolute; 13 position: absolute;
12 right: 8px; 14 right: 8px;
13 top: ${8 + kStatusBarHeight}px;'''); 15 top: ${8 + kStatusBarHeight}px;''');
14 16
15 PopupMenuController controller; 17 PopupMenuController controller;
16 18
17 StockMenu({Object key, this.controller}) : super(key: key); 19 StockMenu({Object key, this.controller, this.autorefresh: false, this.onAutore freshChanged}) : super(key: key);
20
21 final bool autorefresh;
22 final ValueChanged onAutorefreshChanged;
23
24 static FlexBoxParentData _flex1 = new FlexBoxParentData()..flex = 1;
18 25
19 UINode build() { 26 UINode build() {
27 var checkbox = new Checkbox(
28 checked: this.autorefresh,
29 onChanged: this.onAutorefreshChanged
30 );
31
20 return new StyleNode( 32 return new StyleNode(
21 new PopupMenu( 33 new PopupMenu(
22 controller: controller, 34 controller: controller,
23 items: [ 35 items: [
24 [new Text('Add stock')], 36 [new Text('Add stock')],
25 [new Text('Remove stock')], 37 [new Text('Remove stock')],
26 [new Text('Help & feedback')], 38 [new ParentDataNode(new Text('Autorefresh'), _flex1), checkbox],
27 ], 39 ],
28 level: 4), 40 level: 4),
29 _style 41 _style
30 ); 42 );
31 } 43 }
32 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698