$UikPassProgressPropsFromJson function
Implementation
UikPassProgressProps $UikPassProgressPropsFromJson(Map<String, dynamic> json) {
final UikPassProgressProps uikPassProgressProps = UikPassProgressProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikPassProgressProps.id = id;
}
final double? horizontalPadding =
jsonConvert.convert<double>(json['horizontalPadding']);
if (horizontalPadding != null) {
uikPassProgressProps.horizontalPadding = horizontalPadding;
}
final double? verticalPadding =
jsonConvert.convert<double>(json['verticalPadding']);
if (verticalPadding != null) {
uikPassProgressProps.verticalPadding = verticalPadding;
}
final double? height = jsonConvert.convert<double>(json['height']);
if (height != null) {
uikPassProgressProps.height = height;
}
final double? leftMargin = jsonConvert.convert<double>(json["leftMargin"]);
if (leftMargin != null) {
uikPassProgressProps.leftMargin = leftMargin;
}
final double? rightMargin = jsonConvert.convert<double>(json["rightMargin"]);
if (rightMargin != null) {
uikPassProgressProps.rightMargin = rightMargin;
}
final double? topMargin = jsonConvert.convert<double>(json["topMargin"]);
if (topMargin != null) {
uikPassProgressProps.topMargin = topMargin;
}
final double? bottomMargin =
jsonConvert.convert<double>(json["bottomMargin"]);
if (bottomMargin != null) {
uikPassProgressProps.bottomMargin = bottomMargin;
}
final Map<String, dynamic>? profileImage =
jsonConvert.convert<Map<String, dynamic>>(json['progressImage']);
if (profileImage != null) {
final String? id = jsonConvert.convert<String>(profileImage['id']);
if (id != null) {
if (id == "avatar") {
uikPassProgressProps.progressImage = UikAvatar(
WidgetType.UikAvatar, UikAvatarProps.fromJson(profileImage));
} else {
uikPassProgressProps.progressImage = UikImage(
WidgetType.UikAvatar, UikImageProps.fromJson(profileImage));
}
} else {
uikPassProgressProps.progressImage = UikAvatar(
WidgetType.UikAvatar, UikAvatarProps.fromJson(profileImage));
}
}
final Map<String, dynamic>? lowerWidget =
jsonConvert.convert<Map<String, dynamic>>(json['lowerWidget']);
if (lowerWidget != null) {
final String? id = jsonConvert.convert<String>(lowerWidget['id']);
if (id != null) {
if (id == "text") {
uikPassProgressProps.firstWidget = (UikContainerText(
WidgetType.UikAvatar, UikContainerTextProps.fromJson(lowerWidget)));
}
} else {
uikPassProgressProps.firstWidget = (UikContainerText(
WidgetType.UikAvatar, UikContainerTextProps.fromJson(lowerWidget)));
}
}
final Map<String, dynamic>? upperImage =
jsonConvert.convert<Map<String, dynamic>>(json['upperImage']);
if (upperImage != null) {
final String? id = jsonConvert.convert<String>(upperImage['id']);
if (id != null) {
if (id == "avatar") {
uikPassProgressProps.upperImage = UikAvatar(
WidgetType.UikAvatar, UikAvatarProps.fromJson(upperImage));
} else {
uikPassProgressProps.upperImage =
UikImage(WidgetType.UikAvatar, UikImageProps.fromJson(upperImage));
}
} else {
uikPassProgressProps.upperImage =
UikAvatar(WidgetType.UikAvatar, UikAvatarProps.fromJson(upperImage));
}
}
final double? percent = jsonConvert.convert<double>(json['percent']);
if (percent != null) {
uikPassProgressProps.percent = percent;
}
final double? lineHeight = jsonConvert.convert<double>(json['lineHeight']);
if (lineHeight != null) {
uikPassProgressProps.lineHeight = lineHeight;
}
final int? timer = jsonConvert.convert<int>(json['timer']);
if (timer != null) {
uikPassProgressProps.timer = timer;
}
final String? backgroundColor =
jsonConvert.convert<String>(json['backgroundColor']);
if (backgroundColor != null) {
uikPassProgressProps.linearbackgroundColor = backgroundColor.toColor();
}
final String? progressColor =
jsonConvert.convert<String>(json['progressColor']);
if (progressColor != null) {
uikPassProgressProps.progressColor = progressColor.toColor();
}
final String? Color = jsonConvert.convert<String>(json['color']);
if (Color != null) {
uikPassProgressProps.color = Color.toColor();
}
final Map<String, dynamic>? marker =
jsonConvert.convert<Map<String, dynamic>>(json['marker']);
if (marker != null) {
marker.forEach((key, value) {
double markerKey = double.parse(key);
uikPassProgressProps.markerValue.add(markerKey);
final Map<String, dynamic>? markerValue =
jsonConvert.convert<Map<String, dynamic>>(value);
if (markerValue != null) {
final String? id = jsonConvert.convert<String>(value['id']);
if (id != null) {
if (id == "text") {
uikPassProgressProps.markerWidget.add(UikContainerText(
WidgetType.UikAvatar, UikContainerTextProps.fromJson(value)));
}
} else {
uikPassProgressProps.markerWidget.add(UikContainerText(
WidgetType.UikAvatar, UikContainerTextProps.fromJson(value)));
}
}
});
}
return uikPassProgressProps;
}