diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart index 5a5d5bb262..f8d002d8a7 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_order.dart @@ -162,7 +162,10 @@ class _OrderPageState extends State { floatingActionButton: new FloatingActionButton( onPressed: () { 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), child: new Icon( diff --git a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart index 4a5d5b89c9..9c805d3e0e 100644 --- a/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart +++ b/examples/flutter_gallery/lib/demo/shrine/shrine_page.dart @@ -29,11 +29,13 @@ class ShrinePage extends StatelessWidget { child: new Text('SHRINE', style: ShrineTheme.of(context).appBarTitleStyle) ), backgroundColor: Theme.of(context).canvasColor, - actions: [ // TODO(hansmuller): implement the actions. + actions: [ new IconButton( icon: Icons.shopping_cart, tooltip: 'Shopping cart', - onPressed: () { /* activate the button for now */ } + onPressed: () { + // TODO(hansmuller): implement the action. + } ), new PopupMenuButton( itemBuilder: (BuildContext context) => >[ @@ -49,7 +51,20 @@ class ShrinePage extends StatelessWidget { value: ShrineAction.emptyCart, 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; + } + } ) ] ),