[SYNC]
This commit is contained in:
@@ -75,7 +75,7 @@ class AstromicFormController extends FormController {
|
||||
controller(finalFieldID);
|
||||
}
|
||||
if (groupStructure.values != null && groupStructure.values!.isNotEmpty) {
|
||||
for (String valueID in groupStructure.values!.map(((String, Type) a) => a.$1).toList()) {
|
||||
for (String valueID in groupStructure.values!) {
|
||||
String finalFieldID = '${groupStructure.id}-#$i-$valueID';
|
||||
controller(finalFieldID);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class AstromicFormController extends FormController {
|
||||
List<String> fieldsIDs = groupStructure!.fields.nonNulls.toList();
|
||||
print('fieldIDs: $fieldsIDs');
|
||||
// get the values IDs
|
||||
List<(String, Type)> valuesIDs = groupStructure.values?.nonNulls.toList() ?? <(String, Type)>[];
|
||||
List<String> valuesIDs = groupStructure.values?.nonNulls.toList() ?? <String>[];
|
||||
print('valueIDs: $valuesIDs');
|
||||
|
||||
// get the subGroups
|
||||
@@ -149,7 +149,7 @@ class AstromicFormController extends FormController {
|
||||
instances.add(
|
||||
FormGroupInstance(
|
||||
fields: Map<String, String>.fromEntries(fieldsIDs.map((String id) => MapEntry<String, String>('$formGroupID-#$i-$id', value('$formGroupID-#$i-$id'))).toList()),
|
||||
values: Map<String, dynamic>.fromEntries(valuesIDs.map(((String, Type) a) => MapEntry<String, String>('$formGroupID-#$i-${a.$1}', getValue<dynamic>('$formGroupID-#$i-${a.$1}'))).toList()),
|
||||
values: Map<String, dynamic>.fromEntries(valuesIDs.map((String a) => MapEntry<String, String>('$formGroupID-#$i-$a', getValue<dynamic>('$formGroupID-#$i-$a'))).toList()),
|
||||
subGroups: subValues,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
|
||||
class FormGroupStructure {
|
||||
final String id;
|
||||
final List<String> fields;
|
||||
final List<(String, Type)>? values;
|
||||
final List<String>? values;
|
||||
final List<FormGroupStructure>? subGroups;
|
||||
FormGroupStructure({
|
||||
required this.id,
|
||||
@@ -17,7 +17,7 @@ class FormGroupStructure {
|
||||
FormGroupStructure copyWith({
|
||||
String? id,
|
||||
List<String>? fields,
|
||||
List<(String, Type)>? values,
|
||||
List<String>? values,
|
||||
List<FormGroupStructure>? subGroups,
|
||||
}) {
|
||||
return FormGroupStructure(
|
||||
@@ -32,7 +32,7 @@ class FormGroupStructure {
|
||||
return <String, dynamic>{
|
||||
'id': id,
|
||||
'fields': fields,
|
||||
'values': values?.map(((String, Type) x) => <String, Object>{'id': x.$1, 'type': x.$2}).toList(),
|
||||
'values': values,
|
||||
'subGroups': subGroups?.map((FormGroupStructure x) => x.toMap()).toList(),
|
||||
};
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class FormGroupStructure {
|
||||
return FormGroupStructure(
|
||||
id: map['id'] as String,
|
||||
fields: List<String>.from(map['fields'] as List<String>),
|
||||
values: map['values'] != null ? (map['values'] as Map<String,dynamic>).entries.map((MapEntry<String, dynamic> entry) => (entry.key.toString(),entry.value.runtimeType)).toList() : null,
|
||||
values: map['values'] != null ? List<String>.from(map['values'] as List<String>) : null,
|
||||
subGroups: map['subGroups'] != null ? (map['subGroups'] as List<Map<String, dynamic>>).map((Map<String, dynamic> f) => FormGroupStructure.fromMap(f)).toList() : null,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user