$UikHomeCardTenPropsFromJson function

UikHomeCardTenProps $UikHomeCardTenPropsFromJson(
  1. Map<String, dynamic> json
)

Implementation

UikHomeCardTenProps $UikHomeCardTenPropsFromJson(Map<String, dynamic> json) {
  final UikHomeCardTenProps uikHomeCardTenProps = UikHomeCardTenProps();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    uikHomeCardTenProps.id = id;
  }

  final String? text = jsonConvert.convert<String>(json['text']);
  if (text != null) {
    final String? id = jsonConvert.convert<String>(json['text']["id"]);
    if (id == "containerText") {
      uikHomeCardTenProps.text = UikContainerText(WidgetType.UikAccordion,
          UikContainerTextProps.fromJson(json["text"]));
    } else {
      uikHomeCardTenProps.text =
          UikText(WidgetType.UikText, UikTextProps.fromJson(json['text']));
    }
  }

  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    final String? id = jsonConvert.convert<String>(json['image']["id"]);
    if (id == "containerText") {
      uikHomeCardTenProps.image = UikContainerText(WidgetType.UikAccordion,
          UikContainerTextProps.fromJson(json["image"]));
    } else if (id == "avatar") {
      uikHomeCardTenProps.image = UikAvatar(
          WidgetType.UikAvatar, UikAvatarProps.fromJson(json["image"]));
    } else {
      uikHomeCardTenProps.image = UikImage(
        WidgetType.UikText,
        UikImageProps.fromJson(
          json['image'],
        ),
      );
    }
  }

  final UikAction? action = jsonConvert.convert<UikAction>(json['action']);
  if (action != null) {
    uikHomeCardTenProps.action = action;
  }
  return uikHomeCardTenProps;
}