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

Unified 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: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/framework/components2/ink_well.dart ('k') | sky/sdk/lib/framework/components2/tool_bar.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/components2/menu_item.dart
diff --git a/sky/sdk/lib/framework/components2/menu_item.dart b/sky/sdk/lib/framework/components2/menu_item.dart
index 99c8de22fd5df4e7646e8b988bc84e868ae06a67..203ebbbf09d87aecc5a3ef3bd95937e761bbaa08 100644
--- a/sky/sdk/lib/framework/components2/menu_item.dart
+++ b/sky/sdk/lib/framework/components2/menu_item.dart
@@ -2,34 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'dart:sky' as sky;
import '../fn2.dart';
+import '../rendering/box.dart';
+import '../rendering/flex.dart';
import 'button_base.dart';
import 'icon.dart';
import 'ink_well.dart';
class MenuItem extends ButtonBase {
- static final Style _style = new Style('''
- align-items: center;
- height: 48px;
- -webkit-user-select: none;'''
- );
- static final Style _highlightStyle = new Style('''
- align-items: center;
- height: 48px;
- background: rgba(153, 153, 153, 0.4);
- -webkit-user-select: none;'''
- );
-
- static final Style _iconStyle = new Style('''
- padding: 0px 16px;'''
- );
-
- static final Style _labelStyle = new Style('''
- padding: 0px 16px;'''
- );
-
- static final FlexBoxParentData _labelFlex = new FlexBoxParentData()..flex = 1;
+ static const BoxDecoration highlightDecoration = const BoxDecoration(
+ backgroundColor: const sky.Color.fromARGB(102, 153, 153, 153)
+ );
List<UINode> children;
String icon;
@@ -39,27 +24,27 @@ class MenuItem extends ButtonBase {
UINode buildContent() {
return new EventListenerNode(
- new StyleNode(
- new InkWell(
+ new Container(
+ child: new InkWell(
children: [
- new StyleNode(
- new Icon(
- size: 24,
- type: "${icon}_grey600"
- ),
- _iconStyle
+ new Padding(
+ child: new Icon(type: "${icon}_grey600", size: 24),
+ padding: const EdgeDims.symmetric(horizontal: 16.0)
),
- new ParentDataNode(
- new FlexContainer(
- direction: FlexDirection.Row,
- style: _labelStyle,
- children: children
+ new FlexExpandingChild(
+ new Padding(
+ child: new FlexContainer(
+ direction: FlexDirection.Horizontal,
+ children: children
+ ),
+ padding: const EdgeDims.symmetric(horizontal: 16.0)
),
- _labelFlex
+ 1
)
]
),
- highlight ? _highlightStyle : _style
+ desiredSize: const sky.Size.fromHeight(48.0),
+ decoration: highlight ? highlightDecoration : null
),
onGestureTap: onGestureTap
);
« no previous file with comments | « sky/sdk/lib/framework/components2/ink_well.dart ('k') | sky/sdk/lib/framework/components2/tool_bar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698