$UikNotificationContainerPropsFromJson function
Implementation
UikNotificationContainerProps $UikNotificationContainerPropsFromJson(
Map<String, dynamic> json) {
final UikNotificationContainerProps uikNotificationContainerProps =
UikNotificationContainerProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikNotificationContainerProps.id = id;
}
final double? rightMargin = jsonConvert.convert<double>(json['rightMargin']);
if (rightMargin != null) {
uikNotificationContainerProps.rightMargin = rightMargin;
}
final double? topMargin = jsonConvert.convert<double>(json['topMargin']);
if (topMargin != null) {
uikNotificationContainerProps.topMargin = topMargin;
}
final double? bottomMargin =
jsonConvert.convert<double>(json['bottomMargin']);
if (bottomMargin != null) {
uikNotificationContainerProps.bottomMargin = bottomMargin;
}
final double? leftMargin = jsonConvert.convert<double>(json['leftMargin']);
if (leftMargin != null) {
uikNotificationContainerProps.leftMargin = leftMargin;
}
final String? color = jsonConvert.convert<String>(json['color']);
if (color != null) {
uikNotificationContainerProps.color = color.toColor();
}
// final String? title = jsonConvert.convert<String>(json["title"]);
// final String? date = jsonConvert.convert<String>(json["date"]);
// final String? body = jsonConvert.convert<String>(json["body"]);
// if (title != null) {
// if (json["title"]["id"] == "text") {
// uikNotificationContainerProps.title = UikContainerText(
// WidgetType.UikText, UikContainerTextProps.fromJson(json["title"]));
// }
// }
// if (date != null) {
// if (json["date"]["id"] == "text") {
// uikNotificationContainerProps.date = UikContainerText(
// WidgetType.UikText, UikContainerTextProps.fromJson(json["date"]));
// }
// }
// if (body != null) {
// if (json["body"]["id"] == "text") {
// uikNotificationContainerProps.body = UikContainerText(
// WidgetType.UikText, UikContainerTextProps.fromJson(json["body"]));
// }
// }
uikNotificationContainerProps.title = _extractWidget(json["title"]);
uikNotificationContainerProps.date = _extractWidget(json["date"]);
uikNotificationContainerProps.body = _extractWidget(json["body"]);
final String? body = jsonConvert.convert<String>(json["tags"]);
if (body != null) {
final List<dynamic>? tag = jsonConvert.convert<List<dynamic>>(json["tags"]);
if (tag != null) {
for (var i = 0; i < tag.length; i++) {
var icons;
var texts;
var bgColors;
var textColors;
final Map<String, dynamic>? icon =
jsonConvert.convert<Map<String, dynamic>>(tag[i]['icon']);
if (icon != null) {
final String? link =
jsonConvert.convert<String>(tag[i]['icon']["url"]);
if (link != null) {
final double? size =
jsonConvert.convert<double>(tag[i]['icon']['size']);
if (size != null) {
final String? iconcolor =
jsonConvert.convert<String>(tag[i]['icon']['color']);
if (iconcolor != null) {
icons = SvgPicture.network(
link,
width: size,
height: size,
color: iconcolor.toColor(),
);
} else {
icons = SvgPicture.network(
link,
width: size,
height: size,
);
}
}
}
}
final Map<String, dynamic>? text =
jsonConvert.convert<Map<String, dynamic>>(tag[i]['text']);
if (text != null) {
texts = UikText(WidgetType.UikText, UikTextProps.fromJson(text));
}
final String? bgColor = jsonConvert.convert<String>(tag[i]['bgColor']);
if (bgColor != null) {
bgColors = bgColor.toColor();
}
uikNotificationContainerProps.tags.add(TagProps(
icon: icons,
text: texts,
bgColor: bgColors ?? Colors.black,
));
}
}
}
return uikNotificationContainerProps;
}