$UikCellPropsFromJson function

UikCellProps $UikCellPropsFromJson(
  1. Map<String, dynamic> json
)

Implementation

UikCellProps $UikCellPropsFromJson(Map<String, dynamic> json) {
  final UikCellProps uikCellProps = UikCellProps();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    uikCellProps.id = id;
  }
  final double? widthSize = jsonConvert.convert<double>(json['widthSize']);
  print(widthSize);
  if (widthSize != null) {
    uikCellProps.widthSize = widthSize;
  }

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

  final String? spacer = jsonConvert.convert<String>(json['spacer']);
  if (spacer != null) {
    uikCellProps.titleText = UikSpacer(
        WidgetType.UikSpacer, UikSpacerProps.fromJson(json['spacer']));
  }

  final double? heightSize = jsonConvert.convert<double>(json['heightSize']);
  if (heightSize != null) {
    uikCellProps.heightSize = heightSize;
  }
  final String? titleText = jsonConvert.convert<String>(json['titleText']);
  if (titleText != null) {
    uikCellProps.titleText =
        UikText(WidgetType.UikText, UikTextProps.fromJson(json['titleText']));
  }
  final String? subtitleText =
      jsonConvert.convert<String>(json['subtitleText']);
  if (subtitleText != null) {
    uikCellProps.subtitleText = UikText(
        WidgetType.UikText, UikTextProps.fromJson(json['subtitleText']));
  }

  final String? leftElement = jsonConvert.convert<String>(json['leftElement']);
  if (leftElement != null) {
    // uikCellProps.leftElement = UikCircularClickButton(
    //     WidgetType.UikCircularClickButton,
    //     UikCircularClickButtonProps.fromJson(json['leftElement']));
    uikCellProps.leftElement =
        UikIcon(WidgetType.UikIcon, UikIconProps.fromJson(json['leftElement']));
  }
  final String? rightElement =
      jsonConvert.convert<String>(json['rightElement']);
  if (rightElement != null) {
    if (json["rightElement"]["id"] == "button") {
      uikCellProps.rightElement = UikButton(
          WidgetType.UikText, UikButtonProps.fromJson(json['rightElement']));
    }
    if (json["rightElement"]["id"] == "text") {
      uikCellProps.rightElement = UikContainerText(WidgetType.UikText,
          UikContainerTextProps.fromJson(json['rightElement']));
    }
    if (json["rightElement"]["id"] == "icon") {
      uikCellProps.rightElement = UikIcon(
          WidgetType.UikText, UikIconProps.fromJson(json['rightElement']));
    }
    if (json["rightElement"]["id"] == "iconDropDown") {
      uikCellProps.rightElement = UikDropDown(WidgetType.UikDropDown,
          UikDropDownProps.fromJson(json['rightElement']));
    }

    if (json["rightElement"]["id"] == "circularClickButton") {
      uikCellProps.rightElement = UikCircularClickButton(
        WidgetType.UikCircularClickButton,
        UikCircularClickButtonProps.fromJson(json["rightElement"]),
      );
    }
  }

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

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

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

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

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

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