mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make PopupMenuItem take a single child instead of an implicitly-flex list of children.
TBR=abarth Review URL: https://codereview.chromium.org/1187463013.
This commit is contained in:
parent
bb53cd828c
commit
fc5d7261ec
@ -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
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user