Commit 5e6baf4a authored by Ian Hickson's avatar Ian Hickson

Correct grammar in shrine demo (#4381)

I was also going to implement sorting and emptying the cart but the
current data model doesn't make that easy, so I gave up on that. That's
why the TODOs are moved around though.
parent 1c1aa59b
...@@ -162,7 +162,10 @@ class _OrderPageState extends State<OrderPage> { ...@@ -162,7 +162,10 @@ class _OrderPageState extends State<OrderPage> {
floatingActionButton: new FloatingActionButton( floatingActionButton: new FloatingActionButton(
onPressed: () { onPressed: () {
updateOrder(inCart: true); updateOrder(inCart: true);
showSnackBarMessage('There are ${currentOrder.quantity} items in the shopping cart'); final int n = currentOrder.quantity;
showSnackBarMessage(
'There ${ n == 1 ? "is one item" : "are $n items" } in the shopping cart.'
);
}, },
backgroundColor: const Color(0xFF16F0F0), backgroundColor: const Color(0xFF16F0F0),
child: new Icon( child: new Icon(
......
...@@ -29,11 +29,13 @@ class ShrinePage extends StatelessWidget { ...@@ -29,11 +29,13 @@ class ShrinePage extends StatelessWidget {
child: new Text('SHRINE', style: ShrineTheme.of(context).appBarTitleStyle) child: new Text('SHRINE', style: ShrineTheme.of(context).appBarTitleStyle)
), ),
backgroundColor: Theme.of(context).canvasColor, backgroundColor: Theme.of(context).canvasColor,
actions: <Widget>[ // TODO(hansmuller): implement the actions. actions: <Widget>[
new IconButton( new IconButton(
icon: Icons.shopping_cart, icon: Icons.shopping_cart,
tooltip: 'Shopping cart', tooltip: 'Shopping cart',
onPressed: () { /* activate the button for now */ } onPressed: () {
// TODO(hansmuller): implement the action.
}
), ),
new PopupMenuButton<ShrineAction>( new PopupMenuButton<ShrineAction>(
itemBuilder: (BuildContext context) => <PopupMenuItem<ShrineAction>>[ itemBuilder: (BuildContext context) => <PopupMenuItem<ShrineAction>>[
...@@ -49,7 +51,20 @@ class ShrinePage extends StatelessWidget { ...@@ -49,7 +51,20 @@ class ShrinePage extends StatelessWidget {
value: ShrineAction.emptyCart, value: ShrineAction.emptyCart,
child: new Text('Empty shopping cart') child: new Text('Empty shopping cart')
) )
] ],
onSelected: (ShrineAction action) {
switch (action) {
case ShrineAction.sortByPrice:
// TODO(hansmuller): implement the action.
break;
case ShrineAction.sortByProduct:
// TODO(hansmuller): implement the action.
break;
case ShrineAction.emptyCart:
// TODO(hansmuller): implement the action.
break;
}
}
) )
] ]
), ),
......
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