[SYNC] Doing the initial Values thing.

This commit is contained in:
2025-05-28 12:42:58 +03:00
parent 81c7ad9692
commit 379c9ab4c8

View File

@@ -2,6 +2,7 @@
//s2 Core Package Imports
import 'dart:async';
import 'dart:developer';
import 'package:flutter/widgets.dart';
import 'package:flutter/scheduler.dart';
//s2 1st-party Package Imports
@@ -283,11 +284,13 @@ class AstromicFormController extends FormController {
for (final String fieldID in structure.fields) {
final String fullID = standeredGroupFormat(baseID, index.toString(), fieldID);
log('Trying to initialize and add $fullID');
controller(fullID);
}
for (final String valueID in structure.values ?? <String>[]) {
final String fullID = standeredGroupFormat(baseID, index.toString(), valueID);
log('Trying to initialize and add $fullID');
controller(fullID);
}
}
@@ -586,6 +589,7 @@ class AstromicFormController extends FormController {
// }
// }
_initializeFormGroups(Map<String, InitialFormGroupValue> initVals, {Map<String, int>? parents}) {
log('Now we have groups, Initialize them with the parent: $parents');
for (MapEntry<String, InitialFormGroupValue> groupValueEntry in initVals.entries) {
String groupID = groupValueEntry.key;
InitialFormGroupValue groupValue = groupValueEntry.value;
@@ -599,6 +603,7 @@ class AstromicFormController extends FormController {
}
String? prefix = parents?.entries.map((MapEntry<String, int> parentEntry) => standeredGroupFormat(parentEntry.key, parentEntry.value.toString(), null)).join('-');
log('Got the prefix, it\'s $prefix');
// Fields
if (groupValue.fieldValues != null) {
@@ -611,6 +616,7 @@ class AstromicFormController extends FormController {
String fID = standeredGroupFormat((prefix != null ? '$prefix-' : '') + groupID, i.toString(), fieldKey);
String? fieldValue = fve.value[i] ?? '';
bool obscValue = groupValue.fieldObscurityValues?[fieldKey]?[i] ?? false;
log('Doing the controller $fID with initialText $fieldValue');
controller(fID, initialText: fieldValue, isObscure: obscValue);
}
}
@@ -623,6 +629,7 @@ class AstromicFormController extends FormController {
String fID = standeredGroupFormat((prefix != null ? '$prefix-' : '') + groupID, i.toString(), fieldKey);
dynamic fieldValue = hve.value[i].$1;
bool isReq = hve.value[i].$2;
log('Doing the controller $fID with initial Value $fieldValue');
setValue(fID, fieldValue, isRequired: isReq);
}