dev #1
@ -24,12 +24,27 @@ class SuccessSaveOrderPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SuccessSaveOrderPageState extends State<SuccessSaveOrderPage> {
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
context
|
context
|
||||||
.read<OrderLoaderBloc>()
|
.read<OrderLoaderBloc>()
|
||||||
.add(OrderLoaderEvent.getById(widget.orderId));
|
.add(OrderLoaderEvent.getById(widget.orderId));
|
||||||
|
getPrice();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -711,7 +726,7 @@ class _SuccessSaveOrderPageState extends State<SuccessSaveOrderPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(order.totalAmount ?? 0).toString().currencyFormatRpV2,
|
totalPrice.toString().currencyFormatRpV2,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@ -880,7 +895,7 @@ class _SuccessSaveOrderPageState extends State<SuccessSaveOrderPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
(order.totalAmount ?? 0).toString().currencyFormatRpV2,
|
totalPrice.toString().currencyFormatRpV2,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@ -958,7 +973,7 @@ class _SuccessSaveOrderPageState extends State<SuccessSaveOrderPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
(order.totalAmount ?? 0).toString().currencyFormatRpV2,
|
totalPrice.toString().currencyFormatRpV2,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user