$UikOrderProductCardPropsFromJson function

UikOrderProductCardProps $UikOrderProductCardPropsFromJson(
  1. Map<String, dynamic> json
)

Implementation

UikOrderProductCardProps $UikOrderProductCardPropsFromJson(
    Map<String, dynamic> json) {
  final UikOrderProductCardProps uikOrderProductCardProps =
      UikOrderProductCardProps();

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

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

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

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

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

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

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

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

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

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

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

  final List<dynamic>? widgetList =
      jsonConvert.convert<List<dynamic>>(json['widgetList']);
  if (widgetList != null) {
    for (int i = 0; i < widgetList.length; i++) {
      if (widgetList[i]['id'] == 'titleScrollProducts') {
        uikOrderProductCardProps.widgetList.add(
          UikScrollProducts(
            WidgetType.UikScrollProducts,
            UikScrollProductsProps.fromJson(
              widgetList[i],
            ),
          ),
        );
      } else if (widgetList[i]['id'] == 'titleTwoComponentRow') {
        uikOrderProductCardProps.widgetList.add(
          UikTwoComponentRow(
            WidgetType.UikTwoComponentRow,
            UikTwoComponentRowProps.fromJson(
              widgetList[i],
            ),
          ),
        );
      }
    }
  }

  return uikOrderProductCardProps;
}