$UikImageOverlayPropsFromJson function
Implementation
UikImageOverlayProps $UikImageOverlayPropsFromJson(Map<String, dynamic> json) {
UikImageOverlayProps uikImageOverlayProps = UikImageOverlayProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikImageOverlayProps.id = id;
}
final String? color = jsonConvert.convert<String>(json['color']);
if (color != null) {
uikImageOverlayProps.color = color.toColor();
}
final double? height = jsonConvert.convert(json['height']);
if (height != null) {
uikImageOverlayProps.height = height;
}
final double? width = jsonConvert.convert(json['width']);
if (width != null) {
uikImageOverlayProps.width = width;
}
final double? margin = jsonConvert.convert(json['margin']);
if (margin != null) {
uikImageOverlayProps.margin = EdgeInsets.symmetric(
horizontal: margin,
vertical: margin,
);
}
final double? padding = jsonConvert.convert(json['padding']);
if (padding != null) {
uikImageOverlayProps.padding = EdgeInsets.symmetric(
horizontal: padding,
vertical: padding,
);
}
final String? image = jsonConvert.convert<String>(json['image']);
if (image != null) {
uikImageOverlayProps.image = NetworkImage(image);
}
final String? child = jsonConvert.convert<String>(json['child']);
final String? childType = jsonConvert.convert(json['childType']);
if (child != null) {
if (childType == 'text') {
uikImageOverlayProps.child = UikText(
WidgetType.UikText,
UikTextProps.fromJson(
json['child'],
),
);
}
}
final double? borderRadius = jsonConvert.convert(json['borderRadius']);
if (borderRadius != null) {
uikImageOverlayProps.borderRadius = BorderRadius.circular(borderRadius);
}
final String? alignment = jsonConvert.convert(json['alignment']);
if (alignment != null) {
if (alignment == 'center') {
uikImageOverlayProps.alignment = Alignment.center;
} else if (alignment == 'centerLeft') {
uikImageOverlayProps.alignment = Alignment.centerLeft;
} else if (alignment == 'centerRight') {
uikImageOverlayProps.alignment = Alignment.centerRight;
} else if (alignment == 'topLeft') {
uikImageOverlayProps.alignment = Alignment.topLeft;
} else if (alignment == 'topCenter') {
uikImageOverlayProps.alignment = Alignment.topCenter;
} else if (alignment == 'topRight') {
uikImageOverlayProps.alignment = Alignment.topRight;
} else if (alignment == 'bottomRight') {
uikImageOverlayProps.alignment = Alignment.bottomRight;
} else if (alignment == 'bottomCenter') {
uikImageOverlayProps.alignment = Alignment.bottomCenter;
} else if (alignment == 'bottomLeft') {
uikImageOverlayProps.alignment = Alignment.bottomLeft;
}
}
final String? shape = jsonConvert.convert(json['shape']);
if (shape != null) {
if (shape == 'rectangle') {
uikImageOverlayProps.shape = BoxShape.rectangle;
} else if (shape == 'circle') {
uikImageOverlayProps.shape = BoxShape.circle;
}
}
final String? boxFit = jsonConvert.convert(json['boxFit']);
if (boxFit != null) {
if (boxFit == 'cover') {
uikImageOverlayProps.boxFit = BoxFit.cover;
} else if (boxFit == 'none') {
uikImageOverlayProps.boxFit = BoxFit.none;
} else if (boxFit == 'contain') {
uikImageOverlayProps.boxFit = BoxFit.contain;
} else if (boxFit == 'fill') {
uikImageOverlayProps.boxFit = BoxFit.fill;
} else if (boxFit == 'fitHeight') {
uikImageOverlayProps.boxFit = BoxFit.fitHeight;
} else if (boxFit == 'fitWidth') {
uikImageOverlayProps.boxFit = BoxFit.fitWidth;
} else if (boxFit == 'scaleDown') {
uikImageOverlayProps.boxFit = BoxFit.scaleDown;
}
}
// final colorFilter = jsonConvert.convert(json['colorFilter']);
// if(colorFilter != null){
// uikImageOverlayProps.colorFilter =
//
// }
return uikImageOverlayProps;
}