fix price overwrite

This commit is contained in:
JMARyA 2024-09-16 09:34:57 +02:00
parent 370a5329a9
commit 689fa13a7e
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -99,10 +99,13 @@ class _SupplyPageState extends State<SupplyPage> {
});
},
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;
});
},