$UikAvatarPropsFromJson function
Implementation
UikAvatarProps $UikAvatarPropsFromJson(Map<String, dynamic> json) {
final UikAvatarProps uikAvatarProps = UikAvatarProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikAvatarProps.id = id;
}
final double? leftMargin = jsonConvert.convert<double>(json["leftMargin"]);
if (leftMargin != null) {
uikAvatarProps.leftMargin = leftMargin;
}
final double? rightMargin = jsonConvert.convert<double>(json["rightMargin"]);
if (rightMargin != null) {
uikAvatarProps.rightMargin = rightMargin;
}
final double? topMargin = jsonConvert.convert<double>(json["topMargin"]);
if (topMargin != null) {
uikAvatarProps.topMargin = topMargin;
}
final double? bottomMargin =
jsonConvert.convert<double>(json["bottomMargin"]);
if (bottomMargin != null) {
uikAvatarProps.bottomMargin = bottomMargin;
}
final UikAction? action = jsonConvert.convert<UikAction>(json['action']);
if (action != null) {
uikAvatarProps.action = action;
}
final String? backgroundImage =
jsonConvert.convert<String>(json['backgroundImage']);
if (backgroundImage != null) {
uikAvatarProps.backgroundImage = backgroundImage;
}
final String? backgroundColor =
jsonConvert.convert<String>(json['backgroundColor']);
if (backgroundColor != null) {
uikAvatarProps.backgroundColor = backgroundColor.toColor();
}
final double? radius = jsonConvert.convert<double>(json['radius']);
if (radius != null) {
uikAvatarProps.radius = radius;
}
final String? text = jsonConvert.convert<String>(json['text']);
if (text != null) {
if (json["text"]["id"] == "avatar") {
uikAvatarProps.text = UikAvatar(
WidgetType.UikAccordion, UikAvatarProps.fromJson(json["text"]));
} else {
uikAvatarProps.text =
UikText(WidgetType.UikText, UikTextProps.fromJson(json['text']));
}
}
return uikAvatarProps;
}