2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Improve form for "AddTestResult"

This commit is contained in:
Oliver Walters
2020-05-24 09:34:42 +10:00
parent c13a4d40f0
commit 5280e247f4
2 changed files with 76 additions and 3 deletions

View File

@ -22,7 +22,7 @@ class CheckBoxField extends FormField<bool> {
class StringField extends TextFormField {
StringField({String label, String hint, String initial, Function onSaved, Function validator, bool allowEmpty = false}) :
StringField({String label, String hint, String initial, Function onSaved, Function validator, bool allowEmpty = false, bool isEnabled = true}) :
super(
decoration: InputDecoration(
labelText: label,
@ -30,8 +30,8 @@ class StringField extends TextFormField {
),
initialValue: initial,
onSaved: onSaved,
enabled: isEnabled,
validator: (value) {
print("Value: ${value}");
if (!allowEmpty && value.isEmpty) {
return "Value cannot be empty";
}