diff --git a/lib/presentation/success/pages/success_save_order_page.dart b/lib/presentation/success/pages/success_save_order_page.dart index cf20c80..5d11b7f 100644 --- a/lib/presentation/success/pages/success_save_order_page.dart +++ b/lib/presentation/success/pages/success_save_order_page.dart @@ -24,12 +24,27 @@ class SuccessSaveOrderPage extends StatefulWidget { } class _SuccessSaveOrderPageState extends State { + int totalPrice = 0; + + getPrice() { + setState(() { + totalPrice = widget.productQuantity.fold( + 0, + (previousValue, element) => + previousValue + + (element.product.price! * element.quantity) + + (element.variant?.priceModifier ?? 0), + ); + }); + } + @override void initState() { super.initState(); context .read() .add(OrderLoaderEvent.getById(widget.orderId)); + getPrice(); } @override @@ -711,7 +726,7 @@ class _SuccessSaveOrderPageState extends State { ), ), Text( - (order.totalAmount ?? 0).toString().currencyFormatRpV2, + totalPrice.toString().currencyFormatRpV2, style: const TextStyle( fontSize: 24, fontWeight: FontWeight.bold, @@ -880,7 +895,7 @@ class _SuccessSaveOrderPageState extends State { ], ), Text( - (order.totalAmount ?? 0).toString().currencyFormatRpV2, + totalPrice.toString().currencyFormatRpV2, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -958,7 +973,7 @@ class _SuccessSaveOrderPageState extends State { ], ), child: Text( - (order.totalAmount ?? 0).toString().currencyFormatRpV2, + totalPrice.toString().currencyFormatRpV2, style: const TextStyle( fontSize: 18, fontWeight: FontWeight.bold,