From a64f46d79c6afb996721aa2fa40366e6d79d6991 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 8 Apr 2020 12:24:32 +1000 Subject: [PATCH] Selectively show certain buttons in the StockItem FAB menu --- lib/widget/stock_detail.dart | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index b770d89f..407dc5f3 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -173,25 +173,28 @@ class _StockItemDisplayState extends State { List actionButtons() { var buttons = List(); - buttons.add(SpeedDialChild( - child: Icon(Icons.add_circle), - label: "Add Stock", - onTap: null, + // The following actions only apply if the StockItem is not serialized + if (!item.isSerialized()) { + buttons.add(SpeedDialChild( + child: Icon(Icons.add_circle), + label: "Add Stock", + onTap: null, ) - ); + ); - buttons.add(SpeedDialChild( - child: Icon(Icons.remove_circle), - label: "Remove Stock", - onTap: null, + buttons.add(SpeedDialChild( + child: Icon(Icons.remove_circle), + label: "Remove Stock", + onTap: null, ), - ); + ); - buttons.add(SpeedDialChild( - child: Icon(Icons.check_circle), - label: "Count Stock", - onTap: null, - )); + buttons.add(SpeedDialChild( + child: Icon(Icons.check_circle), + label: "Count Stock", + onTap: null, + )); + } buttons.add(SpeedDialChild( child: Icon(Icons.location_on),