mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
ensure exchange is updated properly
This commit is contained in:
parent
287c226416
commit
842593d6b2
2 changed files with 12 additions and 14 deletions
|
@ -646,17 +646,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
||||||
final rateType = ref.watch(
|
final rateType = ref.watch(
|
||||||
prefsChangeNotifierProvider.select((value) => value.exchangeRateType));
|
prefsChangeNotifierProvider.select((value) => value.exchangeRateType));
|
||||||
|
|
||||||
ref.listen<String>(currentExchangeNameStateProvider, (previous, next) {
|
final isEstimated = rateType == ExchangeRateType.estimated;
|
||||||
ref.read(exchangeFormStateProvider).updateExchange(
|
|
||||||
exchange: ref.read(exchangeProvider),
|
|
||||||
shouldUpdateData: true,
|
|
||||||
shouldNotifyListeners: true,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
final isEstimated = ref.watch(prefsChangeNotifierProvider
|
|
||||||
.select((pref) => pref.exchangeRateType)) ==
|
|
||||||
ExchangeRateType.estimated;
|
|
||||||
|
|
||||||
ref.listen(
|
ref.listen(
|
||||||
exchangeFormStateProvider.select((value) => value.toAmountString),
|
exchangeFormStateProvider.select((value) => value.toAmountString),
|
||||||
|
@ -854,9 +844,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
||||||
to: ref.watch(exchangeFormStateProvider).toTicker,
|
to: ref.watch(exchangeFormStateProvider).toTicker,
|
||||||
fromAmount: ref.watch(exchangeFormStateProvider).sendAmount,
|
fromAmount: ref.watch(exchangeFormStateProvider).sendAmount,
|
||||||
toAmount: ref.watch(exchangeFormStateProvider).receiveAmount,
|
toAmount: ref.watch(exchangeFormStateProvider).receiveAmount,
|
||||||
fixedRate: ref.watch(prefsChangeNotifierProvider
|
fixedRate: rateType == ExchangeRateType.fixed,
|
||||||
.select((value) => value.exchangeRateType)) ==
|
|
||||||
ExchangeRateType.fixed,
|
|
||||||
reversed: ref.watch(
|
reversed: ref.watch(
|
||||||
exchangeFormStateProvider.select((value) => value.reversed)),
|
exchangeFormStateProvider.select((value) => value.reversed)),
|
||||||
),
|
),
|
||||||
|
|
|
@ -60,6 +60,11 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
||||||
ChangeNowExchange.exchangeName) {
|
ChangeNowExchange.exchangeName) {
|
||||||
ref.read(currentExchangeNameStateProvider.state).state =
|
ref.read(currentExchangeNameStateProvider.state).state =
|
||||||
ChangeNowExchange.exchangeName;
|
ChangeNowExchange.exchangeName;
|
||||||
|
ref.read(exchangeFormStateProvider).updateExchange(
|
||||||
|
exchange: ref.read(exchangeProvider),
|
||||||
|
shouldUpdateData: true,
|
||||||
|
shouldNotifyListeners: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -290,6 +295,11 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
||||||
MajesticBankExchange.exchangeName) {
|
MajesticBankExchange.exchangeName) {
|
||||||
ref.read(currentExchangeNameStateProvider.state).state =
|
ref.read(currentExchangeNameStateProvider.state).state =
|
||||||
MajesticBankExchange.exchangeName;
|
MajesticBankExchange.exchangeName;
|
||||||
|
ref.read(exchangeFormStateProvider).updateExchange(
|
||||||
|
exchange: ref.read(exchangeProvider),
|
||||||
|
shouldUpdateData: true,
|
||||||
|
shouldNotifyListeners: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
Loading…
Reference in a new issue