Fixed navigation

This commit is contained in:
Arseni
2025-11-21 21:09:32 +03:00
parent acbab71a57
commit 775312d174
3 changed files with 25 additions and 9 deletions

View File

@@ -18,6 +18,7 @@ class PageSelectorProvider extends ChangeNotifier {
PayoutDestination _selected = PayoutDestination.dashboard;
PaymentType? _type;
bool _cameFromRecipientList = false;
PayoutDestination? _previousDestination;
RecipientProvider? recipientProvider;
WalletsProvider? walletsProvider;
@@ -52,6 +53,7 @@ class PageSelectorProvider extends ChangeNotifier {
if (recipientProvider != null) {
recipientProvider!.selectRecipient(recipient);
_cameFromRecipientList = fromList;
_setPreviousDestination();
_selected = PayoutDestination.payment;
notifyListeners();
} else {
@@ -88,15 +90,19 @@ class PageSelectorProvider extends ChangeNotifier {
}
_type = type;
_cameFromRecipientList = false;
_setPreviousDestination();
_selected = PayoutDestination.payment;
notifyListeners();
}
void goBackFromPayment() {
_selected = _cameFromRecipientList
? PayoutDestination.recipients
: PayoutDestination.dashboard;
_selected = _previousDestination ??
(_cameFromRecipientList
? PayoutDestination.recipients
: PayoutDestination.dashboard);
_type = null;
_previousDestination = null;
_cameFromRecipientList = false;
notifyListeners();
}
@@ -116,7 +122,8 @@ class PageSelectorProvider extends ChangeNotifier {
void startPaymentFromWallet(Wallet wallet) {
_type = PaymentType.wallet;
_cameFromRecipientList = true;
_cameFromRecipientList = false;
_setPreviousDestination();
_selected = PayoutDestination.payment;
notifyListeners();
}
@@ -171,6 +178,12 @@ class PageSelectorProvider extends ChangeNotifier {
}
}
void _setPreviousDestination() {
if (_selected != PayoutDestination.payment) {
_previousDestination = _selected;
}
}
Recipient? get selectedRecipient => recipientProvider?.selectedRecipient;
Wallet? get selectedWallet => walletsProvider?.selectedWallet;
}
}