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

Side by Side Diff: sky/sdk/lib/framework/components2/menu_item.dart

Issue 1172173002: Clean up a bunch of our Dart code. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: upstream merge Created 5 years, 6 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 '../fn2.dart'; 5 import '../fn2.dart';
6 import 'button_base.dart'; 6 import 'button_base.dart';
7 import 'icon.dart'; 7 import 'icon.dart';
8 import 'ink_well.dart'; 8 import 'ink_well.dart';
9 9
10 class MenuItem extends ButtonBase { 10 class MenuItem extends ButtonBase {
11 11
12 MenuItem({ Object key, this.icon, this.children, this.onGestureTap }) : super( key: key);
13
12 static const BoxDecoration highlightDecoration = const BoxDecoration( 14 static const BoxDecoration highlightDecoration = const BoxDecoration(
13 backgroundColor: const Color.fromARGB(102, 153, 153, 153) 15 backgroundColor: const Color.fromARGB(102, 153, 153, 153)
14 ); 16 );
15 17
16 List<UINode> children; 18 List<UINode> children;
17 String icon; 19 String icon;
18 GestureEventListener onGestureTap; 20 GestureEventListener onGestureTap;
19 21
20 MenuItem({ Object key, this.icon, this.children, this.onGestureTap }) : super( key: key);
21
22 UINode buildContent() { 22 UINode buildContent() {
23 return new EventListenerNode( 23 return new EventListenerNode(
24 new Container( 24 new Container(
25 child: new InkWell( 25 child: new InkWell(
26 children: [ 26 children: [
27 new Padding( 27 new Padding(
28 child: new Icon(type: "${icon}_grey600", size: 24), 28 child: new Icon(type: "${icon}_grey600", size: 24),
29 padding: const EdgeDims.symmetric(horizontal: 16.0) 29 padding: const EdgeDims.symmetric(horizontal: 16.0)
30 ), 30 ),
31 new FlexExpandingChild( 31 new FlexExpandingChild(
32 new Padding( 32 new Padding(
33 child: new FlexContainer( 33 child: new FlexContainer(
34 direction: FlexDirection.horizontal, 34 direction: FlexDirection.horizontal,
35 children: children 35 children: children
36 ), 36 ),
37 padding: const EdgeDims.symmetric(horizontal: 16.0) 37 padding: const EdgeDims.symmetric(horizontal: 16.0)
38 ), 38 ),
39 flex: 1 39 flex: 1
40 ) 40 )
41 ] 41 ]
42 ), 42 ),
43 height: 48.0, 43 height: 48.0,
44 decoration: highlight ? highlightDecoration : null 44 decoration: highlight ? highlightDecoration : null
45 ), 45 ),
46 onGestureTap: onGestureTap 46 onGestureTap: onGestureTap
47 ); 47 );
48 } 48 }
49
49 } 50 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/material.dart ('k') | sky/sdk/lib/framework/components2/modal_overlay.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698