hide exchange options until amount is entered

This commit is contained in:
Marco 2022-10-15 17:56:59 -06:00
parent 9df7894142
commit d26ea4c284

View file

@ -1308,20 +1308,24 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
RateTypeToggle( RateTypeToggle(
onChanged: onRateTypeChanged, onChanged: onRateTypeChanged,
), ),
const SizedBox( if (ref.read(exchangeFormStateProvider).fromAmount != null &&
height: 8, ref.read(exchangeFormStateProvider).fromAmount != Decimal.zero)
), const SizedBox(
ExchangeProviderOptions( height: 8,
from: ref.watch(exchangeFormStateProvider).fromTicker, ),
to: ref.watch(exchangeFormStateProvider).toTicker, if (ref.read(exchangeFormStateProvider).fromAmount != null &&
fromAmount: ref.watch(exchangeFormStateProvider).fromAmount, ref.read(exchangeFormStateProvider).fromAmount != Decimal.zero)
toAmount: ref.watch(exchangeFormStateProvider).toAmount, ExchangeProviderOptions(
fixedRate: ref.watch(prefsChangeNotifierProvider from: ref.watch(exchangeFormStateProvider).fromTicker,
.select((value) => value.exchangeRateType)) == to: ref.watch(exchangeFormStateProvider).toTicker,
ExchangeRateType.fixed, fromAmount: ref.watch(exchangeFormStateProvider).fromAmount,
reversed: ref.watch( toAmount: ref.watch(exchangeFormStateProvider).toAmount,
exchangeFormStateProvider.select((value) => value.reversed)), fixedRate: ref.watch(prefsChangeNotifierProvider
), .select((value) => value.exchangeRateType)) ==
ExchangeRateType.fixed,
reversed: ref.watch(
exchangeFormStateProvider.select((value) => value.reversed)),
),
const SizedBox( const SizedBox(
height: 12, height: 12,
), ),