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

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

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

Powered by Google App Engine
This is Rietveld 408576698