mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
tiny review fixes
This commit is contained in:
@@ -290,6 +290,7 @@ class BuySellCustomAmountInput extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(18),
|
||||
child: NewPrimaryButton(
|
||||
disabled: controller.text.isEmpty,
|
||||
onPressed: onContinuePressed,
|
||||
isLoading: isLoading,
|
||||
text: S.of(context).continue_text,
|
||||
|
||||
@@ -96,10 +96,21 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
|
||||
|
||||
// sets based on the absolute amout (from the fiat/charts api)
|
||||
// works even if you have no rates
|
||||
Future<void> setCryptoAmountFromFiat(String fiatAmount) async => changeCryptoAmount(
|
||||
amount: (double.parse(fiatAmount) / (fiatConversionStore.prices[cryptoCurrency] ?? 0))
|
||||
Future<void> setCryptoAmountFromFiat(String fiatAmount) async {
|
||||
if(fiatAmount.isEmpty) {
|
||||
await changeCryptoAmount(amount: "");
|
||||
return;
|
||||
}
|
||||
|
||||
if(fiatConversionStore.prices[cryptoCurrency] == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
await changeCryptoAmount(
|
||||
amount: (double.parse(fiatAmount) / (fiatConversionStore.prices[cryptoCurrency]!))
|
||||
.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
final AppStore _appStore;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user