Ojan Vafai 88f38ce0e6 Remove all uses of display:block and display:inline-block.
-Make display:flex, flex-direction: column, flex-shrink: 1 the default.
-Simplify StyleAdjuster::adjustStyleForAlignment to remove special cases we
won't need as we make flex the default and remove absolute positioning.
-Fix a bug this exposed in column flexboxes where we'd apply the wrong edge
of border/padding/margin.
-For now leave the default of align-items:stretch. The main change here is
that iframe/img will do width:auto the same as blocks (i.e. the width of
the parent). I think this is a good change, but we'll have to see how it feels
in practice.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1061163002
2015-04-06 16:44:12 -07:00

65 lines
1.4 KiB
Dart

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../fn.dart';
import 'button_base.dart';
import 'icon.dart';
import 'ink_well.dart';
class MenuItem extends ButtonBase {
static final Style _style = new Style('''
transform: translateX(0);
display: flex;
flex-direction: row;
align-items: center;
height: 48px;
-webkit-user-select: none;'''
);
static final Style _highlightStyle = new Style('''
transform: translateX(0);
display: flex;
flex-direction: row;
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;
flex: 1;'''
);
List<UINode> children;
String icon;
MenuItem({ Object key, this.icon, this.children }) : super(key: key);
UINode buildContent() {
return new StyleNode(
new InkWell(
children: [
new StyleNode(
new Icon(
size: 24,
type: "${icon}_grey600"
),
_iconStyle
),
new Container(
style: _labelStyle,
children: children
)
]
),
highlight ? _highlightStyle : _style
);
}
}