| 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 '../fn2.dart'; |  | 
|   6 import 'button_base.dart'; |  | 
|   7 import 'icon.dart'; |  | 
|   8 import 'ink_well.dart'; |  | 
|   9  |  | 
|  10 const BoxDecoration _kHighlightDecoration = const BoxDecoration( |  | 
|  11   backgroundColor: const Color.fromARGB(102, 153, 153, 153) |  | 
|  12 ); |  | 
|  13  |  | 
|  14 // TODO(abarth): We shouldn't need _kHighlightBoring, but currently Container |  | 
|  15 //               isn't smart enough to retain the components it builds when we |  | 
|  16 //               add or remove a |decoration|. For now, we use a transparent |  | 
|  17 //               decoration to avoid changing the structure of the tree. The |  | 
|  18 //               right fix, however, is to make Container smarter about how it |  | 
|  19 //               syncs its subcomponents. |  | 
|  20 const BoxDecoration _kHighlightBoring = const BoxDecoration( |  | 
|  21   backgroundColor: const Color.fromARGB(0, 0, 0, 0) |  | 
|  22 ); |  | 
|  23  |  | 
|  24 class MenuItem extends ButtonBase { |  | 
|  25   MenuItem({ Object key, this.icon, this.children, this.onGestureTap }) : super(
    key: key); |  | 
|  26  |  | 
|  27   String icon; |  | 
|  28   List<UINode> children; |  | 
|  29   GestureEventListener onGestureTap; |  | 
|  30  |  | 
|  31   void syncFields(MenuItem source) { |  | 
|  32     icon = source.icon; |  | 
|  33     children = source.children; |  | 
|  34     onGestureTap = source.onGestureTap; |  | 
|  35     super.syncFields(source); |  | 
|  36   } |  | 
|  37  |  | 
|  38   UINode buildContent() { |  | 
|  39     return new EventListenerNode( |  | 
|  40       new Container( |  | 
|  41         child: new InkWell( |  | 
|  42           children: [ |  | 
|  43             new Padding( |  | 
|  44               child: new Icon(type: "${icon}_grey600", size: 24), |  | 
|  45               padding: const EdgeDims.symmetric(horizontal: 16.0) |  | 
|  46             ), |  | 
|  47             new FlexExpandingChild( |  | 
|  48               new Padding( |  | 
|  49                 child: new Flex(children, direction: FlexDirection.horizontal), |  | 
|  50                 padding: const EdgeDims.symmetric(horizontal: 16.0) |  | 
|  51               ), |  | 
|  52               flex: 1 |  | 
|  53             ) |  | 
|  54           ] |  | 
|  55         ), |  | 
|  56         height: 48.0, |  | 
|  57         decoration: highlight ? _kHighlightDecoration : _kHighlightBoring |  | 
|  58       ), |  | 
|  59       onGestureTap: onGestureTap |  | 
|  60     ); |  | 
|  61   } |  | 
|  62 } |  | 
| OLD | NEW |