diff --git a/lib/pages/exchange_view/exchange_view.dart b/lib/pages/exchange_view/exchange_view.dart index 9281e8a2f..30a895088 100644 --- a/lib/pages/exchange_view/exchange_view.dart +++ b/lib/pages/exchange_view/exchange_view.dart @@ -260,7 +260,11 @@ class _ExchangeViewState extends ConsumerState { .read(fixedRateExchangeFormProvider) .setFromAmountAndCalculateToAmount(Decimal.zero, true); } - _receiveController.text = ""; + _receiveController.text = + ref.read(prefsChangeNotifierProvider).exchangeRateType == + ExchangeRateType.estimated + ? "-" + : ""; } } }); @@ -325,7 +329,7 @@ class _ExchangeViewState extends ConsumerState { : fixedRateExchangeFormProvider.select( (value) => value.toAmountString), (previous, String next) { if (!_receiveFocusNode.hasFocus) { - _receiveController.text = isEstimated ? "-" : next; + _receiveController.text = isEstimated && next.isEmpty ? "-" : next; debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED"); if (_swapLock) { _sendController.text = isEstimated @@ -345,7 +349,12 @@ class _ExchangeViewState extends ConsumerState { debugPrint("SEND AMOUNT LISTENER ACTIVATED"); if (_swapLock) { _receiveController.text = isEstimated - ? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString + ? ref + .read(estimatedRateExchangeFormProvider) + .toAmountString + .isEmpty + ? "-" + : ref.read(estimatedRateExchangeFormProvider).toAmountString : ref.read(fixedRateExchangeFormProvider).toAmountString; } } @@ -424,7 +433,7 @@ class _ExchangeViewState extends ConsumerState { .setFromAmountAndCalculateToAmount( Decimal.zero, false); } - _receiveController.text = ""; + _receiveController.text = isEstimated ? "-" : ""; } }, keyboardType: const TextInputType.numberWithOptions( diff --git a/lib/pages/exchange_view/wallet_initiated_exchange_view.dart b/lib/pages/exchange_view/wallet_initiated_exchange_view.dart index 79c24a3ba..0b4670c12 100644 --- a/lib/pages/exchange_view/wallet_initiated_exchange_view.dart +++ b/lib/pages/exchange_view/wallet_initiated_exchange_view.dart @@ -271,7 +271,11 @@ class _WalletInitiatedExchangeViewState .read(fixedRateExchangeFormProvider) .setFromAmountAndCalculateToAmount(Decimal.zero, true); } - _receiveController.text = ""; + _receiveController.text = + ref.read(prefsChangeNotifierProvider).exchangeRateType == + ExchangeRateType.estimated + ? "-" + : ""; } } }); @@ -329,7 +333,7 @@ class _WalletInitiatedExchangeViewState : fixedRateExchangeFormProvider.select( (value) => value.toAmountString), (previous, String next) { if (!_receiveFocusNode.hasFocus) { - _receiveController.text = isEstimated ? "-" : next; + _receiveController.text = isEstimated && next.isEmpty ? "-" : next; debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED"); if (_swapLock) { _sendController.text = isEstimated @@ -349,7 +353,12 @@ class _WalletInitiatedExchangeViewState debugPrint("SEND AMOUNT LISTENER ACTIVATED"); if (_swapLock) { _receiveController.text = isEstimated - ? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString + ? ref + .read(estimatedRateExchangeFormProvider) + .toAmountString + .isEmpty + ? "-" + : ref.read(estimatedRateExchangeFormProvider).toAmountString : ref.read(fixedRateExchangeFormProvider).toAmountString; } } @@ -469,7 +478,7 @@ class _WalletInitiatedExchangeViewState .setFromAmountAndCalculateToAmount( Decimal.zero, false); } - _receiveController.text = ""; + _receiveController.text = isEstimated ? "-" : ""; } }, keyboardType: const TextInputType.numberWithOptions( @@ -1281,23 +1290,23 @@ class _WalletInitiatedExchangeViewState .exchangeRateType == ExchangeRateType.estimated; - final ft = isEstimated - ? ref - .read( - estimatedRateExchangeFormProvider) - .from - ?.ticker ?? - "" - : ref - .read( - fixedRateExchangeFormProvider) - .market - ?.from ?? - ""; - - final manager = ref - .read(walletsChangeNotifierProvider) - .getManager(walletId); + // final ft = isEstimated + // ? ref + // .read( + // estimatedRateExchangeFormProvider) + // .from + // ?.ticker ?? + // "" + // : ref + // .read( + // fixedRateExchangeFormProvider) + // .market + // ?.from ?? + // ""; + // + // final manager = ref + // .read(walletsChangeNotifierProvider) + // .getManager(walletId); final sendAmount = Decimal.parse(ref .read(estimatedRateExchangeFormProvider) .fromAmountString);