From b18daf3acf010ff669122476beb29352c3fda82e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 7 Feb 2021 09:43:16 +1100 Subject: [PATCH] Load stock detail *before* opening new view --- lib/widget/part_detail.dart | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/widget/part_detail.dart b/lib/widget/part_detail.dart index 76d7d729..45f2fcfe 100644 --- a/lib/widget/part_detail.dart +++ b/lib/widget/part_detail.dart @@ -80,6 +80,14 @@ class _PartDisplayState extends RefreshableState { refresh(); } + void _showStock(BuildContext context) async { + await part.getStockItems(context); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => PartStockDetailWidget(part)) + ); + } + void _editPartDialog() { // Values which can be edited @@ -209,10 +217,7 @@ class _PartDisplayState extends RefreshableState { leading: FaIcon(FontAwesomeIcons.boxes), trailing: Text("${part.inStock}"), onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => PartStockDetailWidget(part)) - ); + _showStock(context); }, ), );