mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Make the popup menu work again.
This removes the requirement that things with the same type things have unique keys. Now, anything without a key is assumed to be interchangeable. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1178723010.
This commit is contained in:
parent
29c1668582
commit
95d090bc5a
@ -114,38 +114,32 @@ class StockHome extends Component {
|
||||
children: [
|
||||
new DrawerHeader(children: [new Text('Stocks')]),
|
||||
new MenuItem(
|
||||
key: 'Stock list',
|
||||
icon: 'action/assessment',
|
||||
children: [new Text('Stock List')]),
|
||||
new MenuItem(
|
||||
key: 'Account Balance',
|
||||
icon: 'action/account_balance',
|
||||
children: [new Text('Account Balance')]),
|
||||
new MenuDivider(key: 'div1'),
|
||||
new MenuDivider(),
|
||||
new MenuItem(
|
||||
key: 'Optimistic Menu Item',
|
||||
icon: 'action/thumb_up',
|
||||
onGestureTap: (event) => _handleStockModeChange(StockMode.optimistic),
|
||||
children: [
|
||||
new Flexible(child: new Text('Optimistic')),
|
||||
new Radio(key: 'optimistic-radio', value: StockMode.optimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
|
||||
new Radio(value: StockMode.optimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
|
||||
]),
|
||||
new MenuItem(
|
||||
key: 'Pessimistic Menu Item',
|
||||
icon: 'action/thumb_down',
|
||||
onGestureTap: (event) => _handleStockModeChange(StockMode.pessimistic),
|
||||
children: [
|
||||
new Flexible(child: new Text('Pessimistic')),
|
||||
new Radio(key: 'pessimistic-radio', value: StockMode.pessimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
|
||||
new Radio(value: StockMode.pessimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
|
||||
]),
|
||||
new MenuDivider(key: 'div2'),
|
||||
new MenuDivider(),
|
||||
new MenuItem(
|
||||
key: 'Settings',
|
||||
icon: 'action/settings',
|
||||
onGestureTap: (event) => _navigator.pushNamed('/settings'),
|
||||
children: [new Text('Settings')]),
|
||||
new MenuItem(
|
||||
key: 'Help & Feedback',
|
||||
icon: 'action/help',
|
||||
children: [new Text('Help & Feedback')])
|
||||
]
|
||||
|
||||
@ -27,16 +27,25 @@ class StockRow extends Component {
|
||||
|
||||
List<Widget> children = [
|
||||
new Container(
|
||||
child: new StockArrow(percentChange: stock.percentChange),
|
||||
margin: const EdgeDims.only(right: 5.0)),
|
||||
new Flexible(child: new Text(stock.symbol), flex: 2, key: "symbol"),
|
||||
// TODO(hansmuller): text-align: right
|
||||
new Flexible(child: new Text(lastSale,
|
||||
style: const TextStyle(textAlign: TextAlign.right)),
|
||||
key: "lastSale"),
|
||||
new Flexible(child: new Text(changeInPrice,
|
||||
style: typography.black.caption.copyWith(textAlign: TextAlign.right)),
|
||||
key: "changeInPrice")
|
||||
child: new StockArrow(percentChange: stock.percentChange),
|
||||
margin: const EdgeDims.only(right: 5.0)
|
||||
),
|
||||
new Flexible(
|
||||
child: new Text(stock.symbol),
|
||||
flex: 2
|
||||
),
|
||||
new Flexible(
|
||||
child: new Text(
|
||||
lastSale,
|
||||
style: const TextStyle(textAlign: TextAlign.right)
|
||||
)
|
||||
),
|
||||
new Flexible(
|
||||
child: new Text(
|
||||
changeInPrice,
|
||||
style: typography.black.caption.copyWith(textAlign: TextAlign.right)
|
||||
)
|
||||
)
|
||||
];
|
||||
|
||||
// TODO(hansmuller): An explicit |height| shouldn't be needed
|
||||
|
||||
@ -41,12 +41,11 @@ class StockSettings extends Component {
|
||||
decoration: new BoxDecoration(backgroundColor: colors.Grey[50]),
|
||||
child: new Block([
|
||||
new MenuItem(
|
||||
key: 'Optimistic Setting',
|
||||
icon: 'action/thumb_up',
|
||||
onGestureTap: (event) => _handleAwesomeChanged(!_awesome),
|
||||
children: [
|
||||
new Flexible(child: new Text('Everything is awesome')),
|
||||
new Checkbox(key: 'awesome', value: _awesome, onChanged: _handleAwesomeChanged)
|
||||
new Checkbox(value: _awesome, onChanged: _handleAwesomeChanged)
|
||||
]
|
||||
),
|
||||
])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user