OLD | NEW |
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 'button_base.dart'; | 6 import 'button_base.dart'; |
7 import 'icon.dart'; | 7 import 'icon.dart'; |
8 import 'material.dart'; | 8 import 'material.dart'; |
9 | 9 |
10 class MenuItem extends ButtonBase { | 10 class MenuItem extends ButtonBase { |
(...skipping 12 matching lines...) Expand all Loading... |
23 height: 48px; | 23 height: 48px; |
24 background: rgba(153, 153, 153, 0.4); | 24 background: rgba(153, 153, 153, 0.4); |
25 -webkit-user-select: none;''' | 25 -webkit-user-select: none;''' |
26 ); | 26 ); |
27 | 27 |
28 static final Style _iconStyle = new Style(''' | 28 static final Style _iconStyle = new Style(''' |
29 padding: 0px 16px;''' | 29 padding: 0px 16px;''' |
30 ); | 30 ); |
31 | 31 |
32 static final Style _labelStyle = new Style(''' | 32 static final Style _labelStyle = new Style(''' |
33 font-family: 'Roboto Medium', 'Helvetica'; | 33 padding: 0px 16px; |
34 color: #212121; | 34 flex: 1;''' |
35 padding: 0px 16px; | |
36 flex: 1;''' | |
37 ); | 35 ); |
38 | 36 |
39 List<Node> children; | 37 List<Node> children; |
40 String icon; | 38 String icon; |
41 | 39 |
42 MenuItem({ Object key, this.icon, this.children }) : super(key: key); | 40 MenuItem({ Object key, this.icon, this.children }) : super(key: key); |
43 | 41 |
44 Node build() { | 42 Node build() { |
45 return new Material ( | 43 return new Material ( |
46 style: highlight ? _highlightStyle : _style, | 44 style: highlight ? _highlightStyle : _style, |
47 children: [ | 45 children: [ |
48 new Icon( | 46 new Icon( |
49 style: _iconStyle, | 47 style: _iconStyle, |
50 size: 24, | 48 size: 24, |
51 type: "${icon}_grey600" | 49 type: "${icon}_grey600" |
52 ), | 50 ), |
53 new Container( | 51 new Container( |
54 style: _labelStyle, | 52 style: _labelStyle, |
55 children: children | 53 children: children |
56 ) | 54 ) |
57 ] | 55 ] |
58 ); | 56 ); |
59 } | 57 } |
60 } | 58 } |
OLD | NEW |