$UikTwoComponentRowPropsFromJson function

UikTwoComponentRowProps $UikTwoComponentRowPropsFromJson(
  1. Map<String, dynamic> json
)

Implementation

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

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

  final bool? enablePadding = jsonConvert.convert<bool>(json['enablePadding']);
  if (action != null) {
    uikTwoComponentRowProps.enablePadding = enablePadding ?? false;
  }

  final String? bgcolor = jsonConvert.convert<String>(json['bgcolor']);
  if (bgcolor != null) {
    uikTwoComponentRowProps.bgcolor = bgcolor.toColor();
  }

  final String? mainAxisAlignment =
      jsonConvert.convert<String>(json['mainAxisAlignment']);
  if (mainAxisAlignment != null) {
    if (mainAxisAlignment == "MainAxisAlignment.spaceBetween") {
      uikTwoComponentRowProps.mainAxisAlignment =
          MainAxisAlignment.spaceBetween;
    }
    if (mainAxisAlignment == "MainAxisAlignment.start") {
      uikTwoComponentRowProps.mainAxisAlignment = MainAxisAlignment.start;
    }
  }

  final String? crossAxisAlignment =
      jsonConvert.convert<String>(json['crossAxisAlignment']);
  if (crossAxisAlignment != null) {
    if (crossAxisAlignment == "CrossAxisAlignment.start") {
      uikTwoComponentRowProps.crossAxisAlignment = CrossAxisAlignment.start;
    }
    if (crossAxisAlignment == "CrossAxisAlignment.end") {
      uikTwoComponentRowProps.crossAxisAlignment = CrossAxisAlignment.end;
    }
  }

  final String? firstComponent =
      jsonConvert.convert<String>(json['firstComponent']);
  print(firstComponent);
  // print(firstComponent);
  if (firstComponent != null) {
    if (json['firstComponent']["id"] == "text") {
      uikTwoComponentRowProps.firstComponent = UikContainerText(
          WidgetType.UikContainerText,
          UikContainerTextProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "cell") {
      uikTwoComponentRowProps.firstComponent = UikCell(
          WidgetType.UikContainerText,
          UikCellProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "product") {
      uikTwoComponentRowProps.firstComponent = UikProductCardGrid(
          WidgetType.UikContainerText,
          UikProductCardGridProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "column") {
      uikTwoComponentRowProps.firstComponent = UikColumn(
          WidgetType.UikContainerText,
          UikColumnProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "stepper") {
      uikTwoComponentRowProps.firstComponent = UikStepper(
          WidgetType.UikText, UikStepperProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "search") {
      uikTwoComponentRowProps.firstComponent = UikSearch(WidgetType.UikSearch,
          UikSearchProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "button") {
      uikTwoComponentRowProps.firstComponent = UikButton(WidgetType.UikButton,
          UikButtonProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "chip") {
      uikTwoComponentRowProps.firstComponent = UikTextChip(WidgetType.UikText,
          UikTextChipProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "icon") {
      uikTwoComponentRowProps.firstComponent = UikIcon(
          WidgetType.UikText, UikIconProps.fromJson(json['firstComponent']));
    }

    if (json['firstComponent']["id"] == "image") {
      uikTwoComponentRowProps.firstComponent = UikImage(
          WidgetType.UikImage, UikImageProps.fromJson(json['firstComponent']));
    }
  }

  final String? secondComponent =
      jsonConvert.convert<String>(json['secondComponent']);
  if (secondComponent != null) {
    if (json['secondComponent']["id"] == "text") {
      uikTwoComponentRowProps.secondComponent = UikContainerText(
          WidgetType.UikContainerText,
          UikContainerTextProps.fromJson(json['secondComponent']));
    }
    if (json['secondComponent']["id"] == "radioButton") {
      uikTwoComponentRowProps.secondComponent = UikRadioButton(
          WidgetType.UikContainerText,
          UikRadioButtonProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "stepper") {
      uikTwoComponentRowProps.secondComponent = UikStepper(WidgetType.UikText,
          UikStepperProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "cell") {
      uikTwoComponentRowProps.secondComponent = UikCell(
          WidgetType.UikContainerText,
          UikCellProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "column") {
      uikTwoComponentRowProps.secondComponent = UikColumn(
          WidgetType.UikContainerText,
          UikColumnProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "search") {
      uikTwoComponentRowProps.secondComponent = UikSearch(WidgetType.UikSearch,
          UikSearchProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "button") {
      uikTwoComponentRowProps.secondComponent = UikButton(WidgetType.UikButton,
          UikButtonProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "chip") {
      uikTwoComponentRowProps.secondComponent = UikTextChip(WidgetType.UikText,
          UikTextChipProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "icon") {
      uikTwoComponentRowProps.secondComponent = UikIcon(
          WidgetType.UikText, UikIconProps.fromJson(json['secondComponent']));
    }

    if (json['secondComponent']["id"] == "image") {
      uikTwoComponentRowProps.secondComponent = UikImage(
          WidgetType.UikText, UikImageProps.fromJson(json['secondComponent']));
    }

    // if(json["secondComponent"]["id"]=="svg"){
    //   uikTwoComponentRowProps.secondComponent=
    // }
  }

  final double? leftMargin = jsonConvert.convert<double>(json['marginLeft']);
  if (leftMargin != null) {
    uikTwoComponentRowProps.marginLeft = leftMargin;
  }

  final double? rightMargin = jsonConvert.convert<double>(json['marginRight']);
  if (rightMargin != null) {
    uikTwoComponentRowProps.marginRight = rightMargin;
  }

  final double? topMargin = jsonConvert.convert<double>(json['marginTop']);
  if (topMargin != null) {
    uikTwoComponentRowProps.marginTop = topMargin;
  }

  final double? height = jsonConvert.convert<double>(json['height']);
  if (height != null) {
    uikTwoComponentRowProps.height = height;
  }

  final double? borderRadius =
      jsonConvert.convert<double>(json['borderRadius']);
  if (borderRadius != null) {
    uikTwoComponentRowProps.borderRadius = borderRadius;
  }

  final double? opacity = jsonConvert.convert<double>(json['opacity']);
  if (opacity != null) {
    uikTwoComponentRowProps.opacity = opacity;
  }

  final double? bottomMargin =
      jsonConvert.convert<double>(json['marginBottom']);
  if (bottomMargin != null) {
    uikTwoComponentRowProps.marginBottom = bottomMargin;
  }
  return uikTwoComponentRowProps;
}