Skip to content

Commit

Permalink
fix: PaymentState not being updated (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-tbd authored Jun 14, 2024
1 parent 63f82c7 commit 1b44bf7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/features/payment/payment_amount_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class PaymentAmountPage extends HookConsumerWidget {
final payinAmount = useState<String>('0');
final payoutAmount = useState<Decimal>(Decimal.zero);
final keyPress = useState(NumberKeyPress(0, ''));
final currentPaymentState = useState<PaymentState>(paymentState);
final selectedPfi = useState<Pfi?>(paymentState.selectedPfi);
final selectedOffering = useState<Offering?>(paymentState.selectedOffering);
final offerings =
Expand Down Expand Up @@ -62,7 +63,7 @@ class PaymentAmountPage extends HookConsumerWidget {
selectedOffering.value = offering;
}

final state = paymentState.copyWith(
currentPaymentState.value = currentPaymentState.value.copyWith(
payinAmount: Decimal.parse(payinAmount.value),
payoutAmount: payoutAmount.value,
selectedPfi: selectedPfi.value,
Expand Down Expand Up @@ -94,14 +95,14 @@ class PaymentAmountPage extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Payin(
paymentState: state,
paymentState: currentPaymentState.value,
payinAmount: payinAmount,
keyPress: keyPress,
onCurrencySelect: onCurrencySelect,
),
const SizedBox(height: Grid.sm),
Payout(
paymentState: state,
paymentState: currentPaymentState.value,
payoutAmount: payoutAmount,
onCurrencySelect: onCurrencySelect,
),
Expand All @@ -123,12 +124,12 @@ class PaymentAmountPage extends HookConsumerWidget {
),
const SizedBox(height: Grid.sm),
NextButton(
onPressed: paymentState.payinAmount == Decimal.zero
onPressed: Decimal.parse(payinAmount.value) == Decimal.zero
? null
: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => PaymentDetailsPage(
paymentState: paymentState,
paymentState: currentPaymentState.value,
),
),
),
Expand Down

0 comments on commit 1b44bf7

Please sign in to comment.