From 689fa13a7eeca4a0bad4026fdab818d31d97ae54 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Mon, 16 Sep 2024 09:34:57 +0200 Subject: [PATCH] fix price overwrite --- lib/pages/supply.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pages/supply.dart b/lib/pages/supply.dart index 89b3b74..64ac6a2 100644 --- a/lib/pages/supply.dart +++ b/lib/pages/supply.dart @@ -99,10 +99,13 @@ class _SupplyPageState extends State { }); }, onSelected: (String selection) async { - var price = - await API().getLatestPrice(widget.item.id, variant); + var price = _price.isEmpty + ? await API() + .getLatestPrice(widget.item.id, variant) + .then((x) => x.value.toStringAsFixed(2)) + : _price; setState(() { - _price = price.value.toStringAsFixed(2); + _price = price; _selectedOrigin = selection; }); },