提交 fc5d7261 编写于 作者: H Hixie

Make PopupMenuItem take a single child instead of an implicitly-flex list of children.

TBR=abarth

Review URL: https://codereview.chromium.org/1187463013.
上级 bb53cd82
......@@ -30,9 +30,9 @@ class StockMenu extends Component {
child: new PopupMenu(
controller: controller,
items: [
[new Text('Add stock')],
[new Text('Remove stock')],
[new Flexible(child: new Text('Autorefresh')), checkbox],
new Text('Add stock'),
new Text('Remove stock'),
new Flex([new Flexible(child: new Text('Autorefresh')), checkbox]),
],
level: 4
),
......
......@@ -67,7 +67,7 @@ class PopupMenu extends AnimatedComponent {
}
PopupMenuController controller;
List<List<UINode>> items;
List<UINode> items;
int level;
void syncFields(PopupMenu source) {
......@@ -92,11 +92,10 @@ class PopupMenu extends AnimatedComponent {
UINode build() {
int i = 0;
List<UINode> children = new List.from(items.map((List<UINode> item) {
List<UINode> children = new List.from(items.map((UINode item) {
double opacity = _opacityFor(i);
// TODO(abarth): Using |i| for the key here seems wrong.
return new PopupMenuItem(key: (i++).toString(),
children: item
return new PopupMenuItem(key: '${key}-${item.key}',
child: item,
opacity: opacity);
}));
......
......@@ -6,9 +6,9 @@ import 'basic.dart';
import 'ink_well.dart';
class PopupMenuItem extends Component {
PopupMenuItem({ String key, this.children, this.opacity}) : super(key: key);
PopupMenuItem({ String key, this.child, this.opacity}) : super(key: key);
final List<UINode> children;
final UINode child;
final double opacity;
UINode build() {
......@@ -18,7 +18,7 @@ class PopupMenuItem extends Component {
child: new Container(
constraints: const BoxConstraints(minWidth: 112.0),
padding: const EdgeDims.all(16.0),
child: new Flex(children)
child: child
)
)
);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册