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

Side by Side Diff: sky/framework/components/popup_menu.dart

Issue 1008003007: Add a menu to the stocks app (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Tweak padding Created 5 years, 9 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 '../fn.dart'; 5 import '../fn.dart';
6 import '../theme/colors.dart'; 6 import '../theme/colors.dart';
7 import 'material.dart'; 7 import 'material.dart';
8 import 'popup_menu_item.dart';
8 9
9 class PopupMenu extends Component { 10 class PopupMenu extends Component {
10 static final Style _style = new Style(''' 11 static final Style _style = new Style('''
11 border-radius: 2px; 12 border-radius: 2px;
13 padding: 8px 0;
12 background-color: ${Grey[50]};''' 14 background-color: ${Grey[50]};'''
13 ); 15 );
14 16
15 List<Node> children; 17 List<List<Node>> items;
16 int level; 18 int level;
17 19
18 PopupMenu({ Object key, this.children, this.level }) : super(key: key); 20 PopupMenu({ Object key, this.items, this.level }) : super(key: key);
19 21
20 Node build() { 22 Node build() {
23 List<Node> children = [];
24 int i = 0;
25 items.forEach((List<Node> item) {
26 children.add(new PopupMenuItem(key: i++, children: item));
27 });
28
21 return new Material( 29 return new Material(
22 style: _style, 30 style: _style,
23 children: children, 31 children: children,
24 level: level 32 level: level
25 ); 33 );
26 } 34 }
27 } 35 }
OLDNEW
« sky/examples/stocks-fn/lib/stock_app.dart ('K') | « sky/examples/widgets-fn/widgets_app.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698