mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
exchange swap currency fix
This commit is contained in:
parent
907f55a418
commit
b7d8e5db63
2 changed files with 28 additions and 39 deletions
|
@ -395,8 +395,10 @@ class ExchangeFormState extends ChangeNotifier {
|
|||
minAmount = null;
|
||||
maxAmount = null;
|
||||
|
||||
switch (exchangeType) {
|
||||
case ExchangeRateType.estimated:
|
||||
if (exchangeType == ExchangeRateType.fixed &&
|
||||
exchange?.name == ChangeNowExchange.exchangeName) {
|
||||
await updateMarket(market, false);
|
||||
} else {
|
||||
final Currency? newTo = from;
|
||||
final Currency? newFrom = to;
|
||||
|
||||
|
@ -409,10 +411,6 @@ class ExchangeFormState extends ChangeNotifier {
|
|||
shouldNotifyListeners: false,
|
||||
reversed: reversed,
|
||||
);
|
||||
break;
|
||||
case ExchangeRateType.fixed:
|
||||
await updateMarket(market, false);
|
||||
break;
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
|
|
|
@ -294,11 +294,9 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
);
|
||||
|
||||
if (ref.read(prefsChangeNotifierProvider).exchangeRateType ==
|
||||
ExchangeRateType.estimated) {
|
||||
await ref.read(exchangeFormStateProvider).swap();
|
||||
} else {
|
||||
switch (ref.read(currentExchangeNameStateProvider.state).state) {
|
||||
case ChangeNowExchange.exchangeName:
|
||||
ExchangeRateType.fixed &&
|
||||
ref.read(exchangeFormStateProvider).exchange?.name ==
|
||||
ChangeNowExchange.exchangeName) {
|
||||
final from = ref.read(exchangeFormStateProvider).fromTicker;
|
||||
final to = ref.read(exchangeFormStateProvider).toTicker;
|
||||
|
||||
|
@ -309,18 +307,11 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
.where((e) => e.from == to && e.to == from);
|
||||
|
||||
if (markets.isNotEmpty) {
|
||||
await ref
|
||||
.read(exchangeFormStateProvider)
|
||||
.swap(market: markets.first);
|
||||
await ref.read(exchangeFormStateProvider).swap(market: markets.first);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SimpleSwapExchange.exchangeName:
|
||||
} else {
|
||||
await ref.read(exchangeFormStateProvider).swap();
|
||||
break;
|
||||
default:
|
||||
//
|
||||
}
|
||||
}
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
|
|
Loading…
Reference in a new issue