| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 import '../fn.dart'; | |
| 6 import '../layout.dart'; | |
| 7 import 'button_base.dart'; | |
| 8 import 'icon.dart'; | |
| 9 import 'ink_well.dart'; | |
| 10 | |
| 11 class MenuItem extends ButtonBase { | |
| 12 static final Style _style = new Style(''' | |
| 13 align-items: center; | |
| 14 height: 48px; | |
| 15 -webkit-user-select: none;''' | |
| 16 ); | |
| 17 | |
| 18 static final Style _highlightStyle = new Style(''' | |
| 19 align-items: center; | |
| 20 height: 48px; | |
| 21 background: rgba(153, 153, 153, 0.4); | |
| 22 -webkit-user-select: none;''' | |
| 23 ); | |
| 24 | |
| 25 static final Style _iconStyle = new Style(''' | |
| 26 padding: 0px 16px;''' | |
| 27 ); | |
| 28 | |
| 29 static final Style _labelStyle = new Style(''' | |
| 30 padding: 0px 16px;''' | |
| 31 ); | |
| 32 | |
| 33 static final FlexBoxParentData _labelFlex = new FlexBoxParentData()..flex = 1; | |
| 34 | |
| 35 List<UINode> children; | |
| 36 String icon; | |
| 37 GestureEventListener onGestureTap; | |
| 38 | |
| 39 MenuItem({ Object key, this.icon, this.children, this.onGestureTap }) : super(
key: key); | |
| 40 | |
| 41 UINode buildContent() { | |
| 42 return new EventListenerNode( | |
| 43 new StyleNode( | |
| 44 new InkWell( | |
| 45 children: [ | |
| 46 new StyleNode( | |
| 47 new Icon( | |
| 48 size: 24, | |
| 49 type: "${icon}_grey600" | |
| 50 ), | |
| 51 _iconStyle | |
| 52 ), | |
| 53 new ParentDataNode( | |
| 54 new FlexContainer( | |
| 55 direction: FlexDirection.Row, | |
| 56 style: _labelStyle, | |
| 57 children: children | |
| 58 ), | |
| 59 _labelFlex | |
| 60 ) | |
| 61 ] | |
| 62 ), | |
| 63 highlight ? _highlightStyle : _style | |
| 64 ), | |
| 65 onGestureTap: onGestureTap | |
| 66 ); | |
| 67 } | |
| 68 } | |
| OLD | NEW |