|
@@ -150,7 +150,7 @@ namespace FlutterCodeGenerator
|
|
|
{
|
|
|
var source = new StringBuilder();
|
|
|
string flutterTypeName = null;
|
|
|
- if(this is UserDefinedGenericComplexModelType)
|
|
|
+ if (this is UserDefinedGenericComplexModelType)
|
|
|
{
|
|
|
flutterTypeName = GetFlutterTypeName(false, false, true);
|
|
|
}
|
|
@@ -204,9 +204,20 @@ namespace FlutterCodeGenerator
|
|
|
}
|
|
|
else if (child is ArrayModelType)
|
|
|
{
|
|
|
- source.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower}Data != null ? ({child.Name_Lower}Data as List).map((e) => {child.ParameterType.Name.Replace("[]", string.Empty)}.fromJson(e)).toList(): const [],");
|
|
|
+
|
|
|
+ var arrayTypeName = child.ParameterType.FullName.Replace("[]", string.Empty);
|
|
|
+ var arrayType = child.ParameterType.Assembly.GetType(arrayTypeName);
|
|
|
+ var modelType = ModelTypeGenerator.Create(arrayType, "");
|
|
|
+ if (modelType is SimpleModelType)
|
|
|
+ {
|
|
|
+ source.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower}Data != null ? ({child.Name_Lower}Data as List).map((e) => e as {child.ParameterType.Name.Replace("[]", string.Empty)}).toList(): const [],");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ source.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower}Data != null ? ({child.Name_Lower}Data as List).map((e) => {child.ParameterType.Name.Replace("[]", string.Empty)}.fromJson(e)).toList(): const [],");
|
|
|
+ }
|
|
|
}
|
|
|
- else if(child is DateTimeModeType)
|
|
|
+ else if (child is DateTimeModeType)
|
|
|
{
|
|
|
source.AppendLine($"\t\t\t{child.Name_Lower}: map['{child.Name_Upper}'] != null ? DateTime.parse(map['{child.Name_Upper}']) : null,");
|
|
|
}
|
|
@@ -319,9 +330,9 @@ namespace FlutterCodeGenerator
|
|
|
{
|
|
|
public ArrayModelType(Type type, string name) : base(type, name)
|
|
|
{
|
|
|
- var arraytypeName = ParameterType.FullName.Replace("[]", string.Empty);
|
|
|
- var arraytype = ParameterType.Assembly.GetType(arraytypeName);
|
|
|
- ModelTypeGenerator.Create(arraytype, "");
|
|
|
+ var arrayTypeName = ParameterType.FullName.Replace("[]", string.Empty);
|
|
|
+ var arrayType = ParameterType.Assembly.GetType(arrayTypeName);
|
|
|
+ ModelTypeGenerator.Create(arrayType, "");
|
|
|
}
|
|
|
|
|
|
public override string GetFlutterTypeName(bool isDefault = true, bool isGenericName = false, bool isSingle = false)
|
|
@@ -361,7 +372,7 @@ namespace FlutterCodeGenerator
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Dictionary Type�� Ĭ��û�и�����
|
|
|
+ /// Dictionary Type
|
|
|
/// </summary>
|
|
|
public class DictionaryModelType : SimpleModelType
|
|
|
{
|
|
@@ -395,7 +406,7 @@ namespace FlutterCodeGenerator
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// �Զ��巺�����࣬Ĭ��һά
|
|
|
+ /// User Defined Generic Complex Model Type
|
|
|
/// </summary>
|
|
|
public class UserDefinedGenericComplexModelType : ComplexModelType
|
|
|
{
|
|
@@ -456,7 +467,7 @@ namespace FlutterCodeGenerator
|
|
|
dartString.AppendLine($"\t{argumentName}{questionMark} {child.Name_Lower};");
|
|
|
}
|
|
|
dartString.AppendLine();
|
|
|
- dartString.AppendLine($"\t{GetFlutterTypeName(false,false,true)}({{");
|
|
|
+ dartString.AppendLine($"\t{GetFlutterTypeName(false, false, true)}({{");
|
|
|
foreach (var child in Children)
|
|
|
{
|
|
|
if (child.DefaultValue != null)
|