$UikSimpleRowPropsFromJson function
Implementation
UikSimpleRowProps $UikSimpleRowPropsFromJson(Map<String, dynamic> json) {
final UikSimpleRowProps uikColumnProps = UikSimpleRowProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikColumnProps.id = id;
}
String? mainAxisAlignment =
jsonConvert.convert<String?>(json["mainAxisAlignment"]);
if (mainAxisAlignment != null) {
uikColumnProps.mainAxisAlignment = getMainAxisAlignment(mainAxisAlignment);
}
String? crossAxisAlignment =
jsonConvert.convert<String?>(json["crossAxisAlignment"]);
if (crossAxisAlignment != null) {
uikColumnProps.crossAxisAlignment =
getCrossAxisAlignment(crossAxisAlignment);
}
String? alignment = jsonConvert.convert<String?>(json["alignment"]);
if (alignment != null) {
switch (alignment) {
case 'bottomCenter':
uikColumnProps.alignment = Alignment.bottomCenter;
break;
case 'bottomLeft':
uikColumnProps.alignment = Alignment.bottomLeft;
break;
case 'bottomRight':
uikColumnProps.alignment = Alignment.bottomRight;
break;
case 'center':
uikColumnProps.alignment = Alignment.center;
break;
case 'centerLeft':
uikColumnProps.alignment = Alignment.centerLeft;
break;
case 'centerRight':
uikColumnProps.alignment = Alignment.centerRight;
break;
case 'topCenter':
uikColumnProps.alignment = Alignment.topCenter;
break;
case 'topLeft':
uikColumnProps.alignment = Alignment.topLeft;
break;
case 'topRight':
uikColumnProps.alignment = Alignment.topRight;
break;
}
}
final List<dynamic>? widgets =
jsonConvert.convert<List<dynamic>>(json["widgets"]);
if (widgets != null) {
for (int i = 0; i < widgets.length; i++) {
if (widgets[i]["id"] == "image") {
uikColumnProps.widgets.add(UikImage(
WidgetType.UikImage, UikImageProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "text") {
uikColumnProps.widgets.add(UikContainerText(WidgetType.UikText,
UikContainerTextProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "avatar") {
uikColumnProps.widgets.add(UikAvatar(
WidgetType.UikAvatar, UikAvatarProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "icon") {
uikColumnProps.widgets.add(UikIcon(
WidgetType.UikText, UikIconProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "txt") {
// UiSdkUtils.prettyPrintJson(widgets[i]);
uikColumnProps.widgets.add(UikText(
WidgetType.UikText, UikTextProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "cell") {
uikColumnProps.widgets.add(UikCell(
WidgetType.UikText, UikCellProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "itext") {
uikColumnProps.widgets.add(UikIconText(
WidgetType.UikText, UikIconTextProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "button") {
uikColumnProps.widgets.add(UikButton(
WidgetType.UikText, UikButtonProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "twoRow") {
uikColumnProps.widgets.add(UikTwoComponentRow(WidgetType.UikText,
UikTwoComponentRowProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "UikSimpleColumn") {
uikColumnProps.widgets.add(UikSimpleColumn(WidgetType.UikSimpleColumn,
UikSimpleColumnProps.fromJson(json["widgets"][i])));
}
if (widgets[i]["id"] == "HomeCardTen") {
uikColumnProps.widgets.add(UikHomeCardTen(WidgetType.UikSimpleColumn,
UikHomeCardTenProps.fromJson(json["widgets"][i])));
}
}
}
final double? leftMargin = jsonConvert.convert<double>(json["leftMargin"]);
if (leftMargin != null) {
uikColumnProps.leftMargin = leftMargin;
}
final String? dividerColor = jsonConvert.convert<String>(json['color']);
if (dividerColor != null) {
uikColumnProps.color = dividerColor.toColor();
}
final double? height = jsonConvert.convert<double>(json["height"]);
if (height != null) {
uikColumnProps.height = height;
}
final double? rightMargin = jsonConvert.convert<double>(json["rightMargin"]);
if (rightMargin != null) {
uikColumnProps.rightMargin = rightMargin;
}
final double? topMargin = jsonConvert.convert<double>(json["topMargin"]);
if (topMargin != null) {
uikColumnProps.topMargin = topMargin;
}
final double? bottomMargin =
jsonConvert.convert<double>(json["bottomMargin"]);
if (bottomMargin != null) {
uikColumnProps.bottomMargin = bottomMargin;
}
return uikColumnProps;
}