$UikContainerPropsFromJson function
Implementation
UikContainerProps $UikContainerPropsFromJson(Map<String, dynamic> json) {
UikContainerProps uikContainerProps = UikContainerProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikContainerProps.id = id;
}
final double? leftMargin = jsonConvert.convert<double>(json['leftMargin']);
if (leftMargin != null) {
uikContainerProps.leftMargin = leftMargin;
}
final double? rightMargin = jsonConvert.convert<double>(json['rightMargin']);
if (rightMargin != null) {
uikContainerProps.rightMargin = rightMargin;
}
final double? topMargin = jsonConvert.convert<double>(json['topMargin']);
if (topMargin != null) {
uikContainerProps.topMargin = topMargin;
}
final double? borderRadius =
jsonConvert.convert<double>(json['borderRadius']);
if (borderRadius != null) {
uikContainerProps.borderRadius = borderRadius;
}
final double? bottomMargin =
jsonConvert.convert<double>(json['bottomMargin']);
if (bottomMargin != null) {
uikContainerProps.bottomMargin = bottomMargin;
}
final double? width = jsonConvert.convert<double>(json['width']);
if (width != null) {
uikContainerProps.width = width;
} else {
uikContainerProps.width = null;
}
final double? height = jsonConvert.convert<double>(json['height']);
if (height != null) {
uikContainerProps.height = height;
} else {
uikContainerProps.height = null;
}
final String? bgColor = jsonConvert.convert<String>(json['bgColor']);
if (bgColor != null) {
uikContainerProps.bgColor = bgColor.toColor();
}
final UikAction? action = jsonConvert.convert<UikAction>(json['action']);
if (action != null) {
uikContainerProps.action = action;
}
final Map<String, dynamic>? widget =
jsonConvert.convert<Map<String, dynamic>>(json['widget']);
final String? type = jsonConvert.convert<String>(json['type']);
if (widget != null) {
if (type == "image") {
uikContainerProps.widget =
UikImage(WidgetType.UikText, UikImageProps.fromJson(widget));
} else if (type == "productcard") {
uikContainerProps.widget = UikHomeCardEleven(
WidgetType.UikText, UikHomeCardElevenProps.fromJson(widget));
} else if (type == "column") {
uikContainerProps.widget =
UikColumn(WidgetType.UikText, UikColumnProps.fromJson(widget));
} else if (type == "row") {
uikContainerProps.widget =
UikRow(WidgetType.UikText, UikRowProps.fromJson(widget));
}
}
return uikContainerProps;
}