update payment page

This commit is contained in:
Efril
2026-03-04 22:43:18 +07:00
parent 4481d24375
commit a739e1c29e
2 changed files with 16 additions and 1 deletions
@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -42,7 +44,9 @@ class _PaymentRightPanelState extends State<PaymentRightPanel> {
int pasMoney3 = 0;
initMoney() {
log('Initializing money values ${widget.state.order.totalAmount}');
setState(() {
log('Initializing money values ${widget.state.order.totalAmount}');
priceValue = widget.state.order.totalAmount;
pasMoney1 = widget.state.order.totalAmount;
pasMoney2 = pasMoney1 ~/ 50000 * 50000 + 50000;
@@ -58,6 +62,17 @@ class _PaymentRightPanelState extends State<PaymentRightPanel> {
initMoney();
}
@override
void didUpdateWidget(PaymentRightPanel oldWidget) {
super.didUpdateWidget(oldWidget);
// Re-init ketika totalAmount sudah tersedia atau berubah
if (oldWidget.state.order.totalAmount != widget.state.order.totalAmount &&
widget.state.order.totalAmount > 0) {
initMoney();
}
}
@override
Widget build(BuildContext context) {
return Container(