feat: success save order

This commit is contained in:
efrilm 2025-08-13 23:08:12 +07:00
parent 6a9a26f71c
commit c09822b470

View File

@ -24,12 +24,27 @@ class SuccessSaveOrderPage extends StatefulWidget {
}
class _SuccessSaveOrderPageState extends State<SuccessSaveOrderPage> {
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<OrderLoaderBloc>()
.add(OrderLoaderEvent.getById(widget.orderId));
getPrice();
}
@override
@ -711,7 +726,7 @@ class _SuccessSaveOrderPageState extends State<SuccessSaveOrderPage> {
),
),
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<SuccessSaveOrderPage> {
],
),
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<SuccessSaveOrderPage> {
],
),
child: Text(
(order.totalAmount ?? 0).toString().currencyFormatRpV2,
totalPrice.toString().currencyFormatRpV2,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,