$UikAccordionNewPropsFromJson function
Implementation
UikAccordionNewProps $UikAccordionNewPropsFromJson(Map<String, dynamic> json) {
final UikAccordionNewProps uikAccordionNewProps = UikAccordionNewProps();
final String? id = jsonConvert.convert<String>(json['id']);
if (id != null) {
uikAccordionNewProps.id = id;
}
final String? headerBackgroundColor =
jsonConvert.convert<String>(json['headerBackgroundColor']);
if (headerBackgroundColor != null) {
uikAccordionNewProps.headerBackgroundColor = headerBackgroundColor.toColor();
}
final String? headerPadding =
jsonConvert.convert<String>(json['headerPadding']);
if (headerPadding != null) {
uikAccordionNewProps.headerPadding = headerPadding as EdgeInsets;
}
final String? paddingBetweenClosedSections =
jsonConvert.convert<String>(json['paddingBetweenClosedSections']);
if (paddingBetweenClosedSections != null) {
uikAccordionNewProps.paddingBetweenClosedSections = double.parse(paddingBetweenClosedSections);
}
final String? paddingListBottom =
jsonConvert.convert<String>(json['paddingListBottom']);
if (paddingListBottom != null) {
uikAccordionNewProps.paddingListBottom = double.parse(paddingListBottom);
}
final String? flipRightIconIfOpen =
jsonConvert.convert<String>(json['flipRightIconIfOpen']);
if (flipRightIconIfOpen != null) {
uikAccordionNewProps.flipRightIconIfOpen= bool.parse(flipRightIconIfOpen);
}
final String? disableScrolling =
jsonConvert.convert<String>(json['disableScrolling']);
if (disableScrolling != null) {
uikAccordionNewProps.disableScrolling = bool.parse(disableScrolling);
}
final String? headerBorderRadius =
jsonConvert.convert<String>(json['headerBorderRadius']);
if (headerPadding != null) {
uikAccordionNewProps.headerBorderRadius = double.parse(headerBorderRadius!);
}
final String? contentBackgroundColor =
jsonConvert.convert<String>(json['contentBackgroundColor']);
if (contentBackgroundColor != null) {
uikAccordionNewProps.contentBackgroundColor = contentBackgroundColor.toColor();
}
final String? contentBorderColor =
jsonConvert.convert<String>(json['contentBorderColor']);
if (contentBorderColor != null) {
uikAccordionNewProps.contentBorderColor = contentBorderColor.toColor();
}
final double? opacity = jsonConvert.convert<double>(json['opacity']);
if (opacity != null) {
uikAccordionNewProps.opacity = opacity;
}
final String? headerComponent =
jsonConvert.convert<String>(json['headerComponent']);
if (headerComponent != null) {
if (json['headerComponent']["id"] == "headerText") {
uikAccordionNewProps.headerComponent = UikContainerText(
WidgetType.UikContainerText,
UikContainerTextProps.fromJson(json['headerComponent']));
}
if (json['headerComponent']["id"] == "text") {
uikAccordionNewProps.headerComponent = UikText(
WidgetType.UikText,
UikTextProps.fromJson(json['headerComponent']));
}
}
final String? contentComponent =
jsonConvert.convert<String>(json['contentComponent']);
if (contentComponent != null) {
if (json['contentComponent']["id"] == "containerText") {
uikAccordionNewProps.contentComponent = UikContainerText(
WidgetType.UikContainerText,
UikContainerTextProps.fromJson(json['contentComponent']));
}
if (json['contentComponent']["id"] == "text") {
uikAccordionNewProps.contentComponent = UikText(
WidgetType.UikText, UikTextProps.fromJson(json['contentComponent']));
}
}
final String? rightComponent =
jsonConvert.convert<String>(json['rightComponent']);
if (rightComponent != null) {
if (json['rightComponent']["id"] == "image") {
uikAccordionNewProps.rightComponent = UikImage(
WidgetType.UikText, UikImageProps.fromJson(json['rightComponent']));
}
if (json['rightComponent']["id"] == "icon") {
uikAccordionNewProps.rightComponent = UikIcon(
WidgetType.UikText, UikIconProps.fromJson(json['rightComponent']));
}
}
final UikAction? action = jsonConvert.convert<UikAction>(json['action']);
if (action != null) {
uikAccordionNewProps.action = action;
}
return uikAccordionNewProps;
}