Merge branch 'staging' into simpleswap

This commit is contained in:
julian 2022-10-02 13:37:17 -06:00
commit 28d41cc5ab
2 changed files with 43 additions and 25 deletions

View file

@ -260,7 +260,11 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
.read(fixedRateExchangeFormProvider)
.setFromAmountAndCalculateToAmount(Decimal.zero, true);
}
_receiveController.text = "";
_receiveController.text =
ref.read(prefsChangeNotifierProvider).exchangeRateType ==
ExchangeRateType.estimated
? "-"
: "";
}
}
});
@ -325,7 +329,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
: 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<ExchangeView> {
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<ExchangeView> {
.setFromAmountAndCalculateToAmount(
Decimal.zero, false);
}
_receiveController.text = "";
_receiveController.text = isEstimated ? "-" : "";
}
},
keyboardType: const TextInputType.numberWithOptions(

View file

@ -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);