Fixed a Bug, Added Validation

This commit is contained in:
Praveen Kumar
2024-10-20 22:47:13 +05:30
parent c1c06b3f9c
commit 9d5ce75e27

View File

@@ -540,11 +540,27 @@ class AddAppPageState extends State<AddAppPage> {
}), }),
if (pickedSource != null) if (pickedSource != null)
GeneratedForm( GeneratedForm(
key: const Key('appId'), key: Key(
'${pickedSource.runtimeType.toString()}-${pickedSource?.hostChanged.toString()}-${pickedSource?.hostIdenticalDespiteAnyChange.toString()}-appId'),
items: [ items: [
[ [
GeneratedFormTextField('appId', GeneratedFormTextField('appId',
label: tr('appId'), required: false), label: tr('appId'),
required: false,
additionalValidators: [
(value) {
if (value == null || value.isEmpty) {
return null;
}
final isValid = RegExp(
r'^([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*$')
.hasMatch(value);
if (!isValid) {
return tr('invalidInput');
}
return null;
}
]),
] ]
], ],
onValueChanges: (values, valid, isBuilding) { onValueChanges: (values, valid, isBuilding) {