fix when leaving and returning to exchange view

This commit is contained in:
julian 2023-02-06 15:50:18 -06:00
parent a94feef80e
commit 243acd09ba
2 changed files with 9 additions and 6 deletions

View file

@ -406,6 +406,10 @@ class ExchangeFormState extends ChangeNotifier {
}
}
Future<void> refresh() => _updateRangesAndEstimate(
shouldNotifyListeners: true,
);
//============================================================================
// private state updaters
//============================================================================

View file

@ -682,16 +682,15 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
if (walletInitiated) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
ref.read(exchangeFormStateProvider).reset(shouldNotifyListeners: true);
// ref.read(fixedRateExchangeFormProvider);
});
} else {
final rateType = (ref.read(prefsChangeNotifierProvider).exchangeRateType);
final isEstimated = rateType == ExchangeRateType.estimated;
_sendController.text =
ref.read(exchangeFormStateProvider).fromAmountString;
_receiveController.text = isEstimated
? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString
: ref.read(exchangeFormStateProvider).toAmountString;
_receiveController.text =
ref.read(exchangeFormStateProvider).toAmountString;
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
ref.read(exchangeFormStateProvider).refresh();
});
}
super.initState();