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

Side by Side Diff: sky/sdk/example/stocks/lib/stock_menu.dart

Issue 1240573007: Make it possible to detect PopupMenuItem presses (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | sky/sdk/lib/widgets/popup_menu.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 '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 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/widgets/popup_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698