Selecting Receive amount is disabled when Estimated rate is active. Display "-" in the Receive amount field in that case

This commit is contained in:
julian 2022-09-30 09:04:50 -06:00
parent a899e97ae2
commit f81784c1c3
2 changed files with 8 additions and 7 deletions

View file

@ -232,7 +232,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
? ref.read(estimatedRateExchangeFormProvider).fromAmountString
: ref.read(fixedRateExchangeFormProvider).fromAmountString;
_receiveController.text = isEstimated
? ref.read(estimatedRateExchangeFormProvider).toAmountString
? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString
: ref.read(fixedRateExchangeFormProvider).toAmountString;
_sendFocusNode.addListener(() async {
@ -325,7 +325,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
: fixedRateExchangeFormProvider.select(
(value) => value.toAmountString), (previous, String next) {
if (!_receiveFocusNode.hasFocus) {
_receiveController.text = next;
_receiveController.text = isEstimated ? "-" : next;
debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED");
if (_swapLock) {
_sendController.text = isEstimated
@ -345,7 +345,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
debugPrint("SEND AMOUNT LISTENER ACTIVATED");
if (_swapLock) {
_receiveController.text = isEstimated
? ref.read(estimatedRateExchangeFormProvider).toAmountString
? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString
: ref.read(fixedRateExchangeFormProvider).toAmountString;
}
}
@ -737,7 +737,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
.exchangeRateType ==
ExchangeRateType.estimated,
onTap: () {
if (_receiveController.text == "-") {
if (!isEstimated && _receiveController.text == "-") {
_receiveController.text = "";
}
},

View file

@ -329,7 +329,7 @@ class _WalletInitiatedExchangeViewState
: fixedRateExchangeFormProvider.select(
(value) => value.toAmountString), (previous, String next) {
if (!_receiveFocusNode.hasFocus) {
_receiveController.text = next;
_receiveController.text = isEstimated ? "-" : next;
debugPrint("RECEIVE AMOUNT LISTENER ACTIVATED");
if (_swapLock) {
_sendController.text = isEstimated
@ -349,7 +349,7 @@ class _WalletInitiatedExchangeViewState
debugPrint("SEND AMOUNT LISTENER ACTIVATED");
if (_swapLock) {
_receiveController.text = isEstimated
? ref.read(estimatedRateExchangeFormProvider).toAmountString
? "-" //ref.read(estimatedRateExchangeFormProvider).toAmountString
: ref.read(fixedRateExchangeFormProvider).toAmountString;
}
}
@ -808,7 +808,8 @@ class _WalletInitiatedExchangeViewState
.exchangeRateType ==
ExchangeRateType.estimated,
onTap: () {
if (_receiveController.text == "-") {
if (!isEstimated &&
_receiveController.text == "-") {
_receiveController.text = "";
}
},