This commit is contained in:
2025-04-08 09:20:07 +02:00
parent 8768f3fc0e
commit fd291dfcf3

View File

@@ -73,11 +73,6 @@ class AstromicFormController extends FormController {
for (MapEntry<String, bool> fieldEntry in groupStructure.fields.entries) {
String fieldID = '${groupStructure.id}-$i-${fieldEntry.key}';
controller(fieldID);
// if (fieldEntry.value) {
// // Is a value field
// } else {
// // Is a text field
// }
}
}
}
@@ -121,20 +116,27 @@ class AstromicFormController extends FormController {
}
}
print('Got the structure: $groupStructure');
// Get the current fields with this ID
Map<String, String> firstSetOfFieldsWithID = Map<String, String>.fromEntries(
controllers.entries.where((MapEntry<String, String> c) => RegExp(formGroupID + r'-#[\d+]-' + groupStructure!.fields.entries.first.key).hasMatch(c.key)).nonNulls.toList(),
);
print('First set of fields: $firstSetOfFieldsWithID');
// get the fields IDs
List<String> fieldsIDs = groupStructure!.fields.entries.where((MapEntry<String, bool> e) => !e.value).nonNulls.map((MapEntry<String, bool> ee) => ee.key).toList();
print('fieldIDs: $fieldsIDs');
// get the values IDs
List<String> valuesIDs = groupStructure.fields.entries.where((MapEntry<String, bool> e) => e.value).nonNulls.map((MapEntry<String, bool> ee) => ee.key).toList();
print('valueIDs: $valuesIDs');
// get the subGroups
List<FormGroupValue> subValues = <FormGroupValue>[];
if (groupStructure.subGroups != null && groupStructure.subGroups!.isNotEmpty) {
subValues = groupStructure.subGroups!.map((FormGroupStructure s) => getFormGroupValue(s.id, isSubGroup: true)).nonNulls.toList();
}
print('subValues: $subValues');
List<FormGroupInstance> instances = <FormGroupInstance>[];
for (int i = 0; i < firstSetOfFieldsWithID.length; i++) {
@@ -192,7 +194,6 @@ class AstromicFormController extends FormController {
// }
// }
void getFormGroupValues(FormGroupStructure group) {}
// Map<String,Map<String,dynamic>> getFormGroup(String groupID){}