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(
|
||||
prefsChangeNotifierProvider.select((value) => value.exchangeRateType));
|
||||
|
||||
ref.listen<String>(currentExchangeNameStateProvider, (previous, next) {
|
||||
ref.read(exchangeFormStateProvider).updateExchange(
|
||||
exchange: ref.read(exchangeProvider),
|
||||
shouldUpdateData: true,
|
||||
shouldNotifyListeners: true,
|
||||
);
|
||||
});
|
||||
|
||||
final isEstimated = ref.watch(prefsChangeNotifierProvider
|
||||
.select((pref) => pref.exchangeRateType)) ==
|
||||
ExchangeRateType.estimated;
|
||||
final isEstimated = rateType == ExchangeRateType.estimated;
|
||||
|
||||
ref.listen(
|
||||
exchangeFormStateProvider.select((value) => value.toAmountString),
|
||||
|
@ -854,9 +844,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
|
|||
to: ref.watch(exchangeFormStateProvider).toTicker,
|
||||
fromAmount: ref.watch(exchangeFormStateProvider).sendAmount,
|
||||
toAmount: ref.watch(exchangeFormStateProvider).receiveAmount,
|
||||
fixedRate: ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.exchangeRateType)) ==
|
||||
ExchangeRateType.fixed,
|
||||
fixedRate: rateType == ExchangeRateType.fixed,
|
||||
reversed: ref.watch(
|
||||
exchangeFormStateProvider.select((value) => value.reversed)),
|
||||
),
|
||||
|
|
|
@ -60,6 +60,11 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
|||
ChangeNowExchange.exchangeName) {
|
||||
ref.read(currentExchangeNameStateProvider.state).state =
|
||||
ChangeNowExchange.exchangeName;
|
||||
ref.read(exchangeFormStateProvider).updateExchange(
|
||||
exchange: ref.read(exchangeProvider),
|
||||
shouldUpdateData: true,
|
||||
shouldNotifyListeners: true,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
@ -290,6 +295,11 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
|||
MajesticBankExchange.exchangeName) {
|
||||
ref.read(currentExchangeNameStateProvider.state).state =
|
||||
MajesticBankExchange.exchangeName;
|
||||
ref.read(exchangeFormStateProvider).updateExchange(
|
||||
exchange: ref.read(exchangeProvider),
|
||||
shouldUpdateData: true,
|
||||
shouldNotifyListeners: true,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
|
Loading…
Reference in a new issue