red warnings not on 0 for exchange

This commit is contained in:
Marco 2022-10-15 20:47:59 -06:00
parent 3dd27d9b53
commit dd00e76623
2 changed files with 16 additions and 10 deletions

View file

@ -92,7 +92,9 @@ class ExchangeFormState extends ChangeNotifier {
String get warning {
if (reversed) {
if (toTicker != null && toAmount != null) {
if (minAmount != null && toAmount! < minAmount!) {
if (minAmount != null &&
toAmount! < minAmount! &&
toAmount! > Decimal.zero) {
return "Minimum amount ${minAmount!.toString()} ${toTicker!.toUpperCase()}";
} else if (maxAmount != null && toAmount! > maxAmount!) {
return "Maximum amount ${maxAmount!.toString()} ${toTicker!.toUpperCase()}";
@ -100,7 +102,9 @@ class ExchangeFormState extends ChangeNotifier {
}
} else {
if (fromTicker != null && fromAmount != null) {
if (minAmount != null && fromAmount! < minAmount!) {
if (minAmount != null &&
fromAmount! < minAmount! &&
fromAmount! > Decimal.zero) {
return "Minimum amount ${minAmount!.toString()} ${fromTicker!.toUpperCase()}";
} else if (maxAmount != null && fromAmount! > maxAmount!) {
return "Maximum amount ${maxAmount!.toString()} ${fromTicker!.toUpperCase()}";

View file

@ -572,14 +572,16 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
if (mounted) {
Navigator.of(context).pop();
}
unawaited(
showFloatingFlushBar(
type: FlushBarType.warning,
message:
"Estimated rate trade pair \"$fromTicker-$toTicker\" unavailable. Reverting to last estimated rate pair.",
context: context,
),
);
if (!(fromTicker == "-" || toTicker == "-")) {
unawaited(
showFloatingFlushBar(
type: FlushBarType.warning,
message:
"Estimated rate trade pair \"$fromTicker-$toTicker\" unavailable. Reverting to last estimated rate pair.",
context: context,
),
);
}
break;
case ExchangeRateType.fixed:
if (!(toTicker == "-" || fromTicker == "-")) {