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

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

Issue 1165983002: Stub out InkWell and implement Sky’s fn2 menu item (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 'dart:sky' as sky;
5 import '../fn2.dart'; 6 import '../fn2.dart';
7 import '../rendering/box.dart';
8 import '../rendering/flex.dart';
6 import 'button_base.dart'; 9 import 'button_base.dart';
7 import 'icon.dart'; 10 import 'icon.dart';
8 import 'ink_well.dart'; 11 import 'ink_well.dart';
9 12
10 class MenuItem extends ButtonBase { 13 class MenuItem extends ButtonBase {
11 static final Style _style = new Style(''' 14 static final BoxDecoration highlightDecoration = new BoxDecoration(
Hixie 2015/06/04 17:53:08 Can you make this const?
jackson 2015/06/04 18:03:24 Done.
12 align-items: center; 15 backgroundColor: const sky.Color.fromARGB(102, 153, 153, 153)
13 height: 48px; 16 );
14 -webkit-user-select: none;'''
15 );
16
17 static final Style _highlightStyle = new Style('''
18 align-items: center;
19 height: 48px;
20 background: rgba(153, 153, 153, 0.4);
21 -webkit-user-select: none;'''
22 );
23
24 static final Style _iconStyle = new Style('''
25 padding: 0px 16px;'''
26 );
27
28 static final Style _labelStyle = new Style('''
29 padding: 0px 16px;'''
30 );
31
32 static final FlexBoxParentData _labelFlex = new FlexBoxParentData()..flex = 1;
33 17
34 List<UINode> children; 18 List<UINode> children;
35 String icon; 19 String icon;
36 GestureEventListener onGestureTap; 20 GestureEventListener onGestureTap;
37 21
38 MenuItem({ Object key, this.icon, this.children, this.onGestureTap }) : super( key: key); 22 MenuItem({ Object key, this.icon, this.children, this.onGestureTap }) : super( key: key);
39 23
40 UINode buildContent() { 24 UINode buildContent() {
41 return new EventListenerNode( 25 return new EventListenerNode(
42 new StyleNode( 26 new Container(
43 new InkWell( 27 child: new InkWell(
44 children: [ 28 children: [
45 new StyleNode( 29 new Padding(
46 new Icon( 30 child: new Icon(type: "${icon}_grey600", size: 24),
47 size: 24, 31 padding: const EdgeDims.symmetric(0.0, 16.0)),
48 type: "${icon}_grey600" 32 new FlexExpandingChild(
33 new Padding(
34 child: new FlexContainer(
35 direction: FlexDirection.Horizontal,
36 children: children
37 ),
38 padding: const EdgeDims.symmetric(0.0, 16.0)
49 ), 39 ),
50 _iconStyle 40 1
51 ),
52 new ParentDataNode(
53 new FlexContainer(
54 direction: FlexDirection.Row,
55 style: _labelStyle,
56 children: children
57 ),
58 _labelFlex
59 ) 41 )
60 ] 42 ]
61 ), 43 ),
62 highlight ? _highlightStyle : _style 44 desiredSize: const sky.Size.fromHeight(48.0),
45 decoration: highlight ? highlightDecoration : null
63 ), 46 ),
64 onGestureTap: onGestureTap 47 onGestureTap: onGestureTap
65 ); 48 );
66 } 49 }
67 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698