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