mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-29 17:31:01 +01:00
Add length validator to the notes
This is also checked server side anyway so we better inform the user before submitting the form
This commit is contained in:
@@ -224,6 +224,14 @@ class MeasurementEntryForm extends StatelessWidget {
|
||||
onSaved: (newValue) {
|
||||
_entryData['notes'] = newValue!;
|
||||
},
|
||||
validator: (value) {
|
||||
const minLength = 1;
|
||||
const maxLength = 100;
|
||||
if (value!.isEmpty || value.length < minLength || value.length > maxLength) {
|
||||
return AppLocalizations.of(context).enterCharacters(minLength, maxLength);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
|
||||
ElevatedButton(
|
||||
|
||||
Reference in New Issue
Block a user