Commit 95d090bc authored by Hixie's avatar Hixie

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.
parent 29c16685
...@@ -114,38 +114,32 @@ class StockHome extends Component { ...@@ -114,38 +114,32 @@ class StockHome extends Component {
children: [ children: [
new DrawerHeader(children: [new Text('Stocks')]), new DrawerHeader(children: [new Text('Stocks')]),
new MenuItem( new MenuItem(
key: 'Stock list',
icon: 'action/assessment', icon: 'action/assessment',
children: [new Text('Stock List')]), children: [new Text('Stock List')]),
new MenuItem( new MenuItem(
key: 'Account Balance',
icon: 'action/account_balance', icon: 'action/account_balance',
children: [new Text('Account Balance')]), children: [new Text('Account Balance')]),
new MenuDivider(key: 'div1'), new MenuDivider(),
new MenuItem( new MenuItem(
key: 'Optimistic Menu Item',
icon: 'action/thumb_up', icon: 'action/thumb_up',
onGestureTap: (event) => _handleStockModeChange(StockMode.optimistic), onGestureTap: (event) => _handleStockModeChange(StockMode.optimistic),
children: [ children: [
new Flexible(child: new Text('Optimistic')), 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( new MenuItem(
key: 'Pessimistic Menu Item',
icon: 'action/thumb_down', icon: 'action/thumb_down',
onGestureTap: (event) => _handleStockModeChange(StockMode.pessimistic), onGestureTap: (event) => _handleStockModeChange(StockMode.pessimistic),
children: [ children: [
new Flexible(child: new Text('Pessimistic')), 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( new MenuItem(
key: 'Settings',
icon: 'action/settings', icon: 'action/settings',
onGestureTap: (event) => _navigator.pushNamed('/settings'), onGestureTap: (event) => _navigator.pushNamed('/settings'),
children: [new Text('Settings')]), children: [new Text('Settings')]),
new MenuItem( new MenuItem(
key: 'Help & Feedback',
icon: 'action/help', icon: 'action/help',
children: [new Text('Help & Feedback')]) children: [new Text('Help & Feedback')])
] ]
......
...@@ -27,16 +27,25 @@ class StockRow extends Component { ...@@ -27,16 +27,25 @@ class StockRow extends Component {
List<Widget> children = [ List<Widget> children = [
new Container( new Container(
child: new StockArrow(percentChange: stock.percentChange), child: new StockArrow(percentChange: stock.percentChange),
margin: const EdgeDims.only(right: 5.0)), 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(
new Flexible(child: new Text(lastSale, child: new Text(stock.symbol),
style: const TextStyle(textAlign: TextAlign.right)), flex: 2
key: "lastSale"), ),
new Flexible(child: new Text(changeInPrice, new Flexible(
style: typography.black.caption.copyWith(textAlign: TextAlign.right)), child: new Text(
key: "changeInPrice") 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 // TODO(hansmuller): An explicit |height| shouldn't be needed
......
...@@ -41,12 +41,11 @@ class StockSettings extends Component { ...@@ -41,12 +41,11 @@ class StockSettings extends Component {
decoration: new BoxDecoration(backgroundColor: colors.Grey[50]), decoration: new BoxDecoration(backgroundColor: colors.Grey[50]),
child: new Block([ child: new Block([
new MenuItem( new MenuItem(
key: 'Optimistic Setting',
icon: 'action/thumb_up', icon: 'action/thumb_up',
onGestureTap: (event) => _handleAwesomeChanged(!_awesome), onGestureTap: (event) => _handleAwesomeChanged(!_awesome),
children: [ children: [
new Flexible(child: new Text('Everything is awesome')), new Flexible(child: new Text('Everything is awesome')),
new Checkbox(key: 'awesome', value: _awesome, onChanged: _handleAwesomeChanged) new Checkbox(value: _awesome, onChanged: _handleAwesomeChanged)
] ]
), ),
]) ])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment