Fix order of cost validations to properly show error for character data.

This commit is contained in:
Hyperling 2025-02-11 14:48:32 -07:00
parent ab9b3e0bf9
commit 3bf3dd3190

View File

@ -289,15 +289,15 @@ class _ExpenseInputDialogState extends State<ExpenseInputDialog> {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return "${Expense.amountText} must be provided."; return "${Expense.amountText} must be provided.";
} }
if (double.tryParse(value) == null) {
return "${Expense.amountText} must be a valid number.";
}
if (double.parse(value) < 0) { if (double.parse(value) < 0) {
return "Please use the Income page rather than having negative expenses."; return "Please use the Income page rather than having negative expenses.";
} }
if (double.parse(value) < 0.01) { if (double.parse(value) < 0.01) {
return "${Expense.amountText} must be one hundreth (0.01) or higher."; return "${Expense.amountText} must be one hundreth (0.01) or higher.";
} }
if (double.tryParse(value) == null) {
return "${Expense.amountText} must be a valid number.";
}
return null; return null;
}, },
onSaved: (value) { onSaved: (value) {