BannerConfig.fromJson constructor
BannerConfig.fromJson(
- Map<String, dynamic> json
)
Implementation
factory BannerConfig.fromJson(Map<String, dynamic> json) {
Map<String, String>? acceptMap;
if (json['accept'] != null) {
acceptMap = Map<String, String>.from(json['accept']);
}
Map<String, String>? rejectMap;
if (json['reject'] != null) {
rejectMap = Map<String, String>.from(json['reject']);
}
Map<String, String>? bannerTextMap;
if (json['banner_text'] != null) {
bannerTextMap = Map<String, String>.from(json['banner_text']);
}
Map<String, String>? bannerHeadingMap;
if (json['banner_heading'] != null) {
bannerHeadingMap = Map<String, String>.from(json['banner_heading']);
}
Map<String, String>? sdkTabHeadingMap;
if (json['sdk_tab_heading'] != null) {
sdkTabHeadingMap = Map<String, String>.from(json['sdk_tab_heading']);
}
Map<String, String>? privacyNoticeTextMap;
if (json['privacy_notice_text'] != null) {
privacyNoticeTextMap = Map<String, String>.from(json['privacy_notice_text']);
}
Map<String, String>? preferenceCenterLinkMap;
if (json['preference_center_link'] != null) {
preferenceCenterLinkMap = Map<String, String>.from(json['preference_center_link']);
}
Map<String, String>? permissionsTabHeadingMap;
if (json['permissions_tab_heading'] != null) {
permissionsTabHeadingMap = Map<String, String>.from(json['permissions_tab_heading']);
}
Map<String, String>? permissionsTabGuidanceMap;
if (json['permissions_tab_guidance'] != null) {
permissionsTabGuidanceMap = Map<String, String>.from(json['permissions_tab_guidance']);
}
Map<String, String>? preferenceCenterHeadingMap;
if (json['preference_center_heading'] != null) {
preferenceCenterHeadingMap = Map<String, String>.from(json['preference_center_heading']);
}
Map<String, String>? preferenceCenterGuidanceMap;
if (json['preference_center_guidance'] != null) {
preferenceCenterGuidanceMap = Map<String, String>.from(json['preference_center_guidance']);
}
Map<String, String>? permissionsTabDescriptionMap;
if (json['permissions_tab_description'] != null) {
permissionsTabDescriptionMap = Map<String, String>.from(json['permissions_tab_description']);
}
Map<String, String>? preferenceCenterDescriptionMap;
if (json['preference_center_description'] != null) {
preferenceCenterDescriptionMap = Map<String, String>.from(json['preference_center_description']);
}
Map<String, Map<String, String>?>? translationsMap;
if (json['translations'] != null) {
translationsMap = {};
(json['translations'] as Map).forEach((key, value) {
if (value != null) {
translationsMap![key.toString()] = Map<String, String>.from(value);
} else {
translationsMap![key.toString()] = null;
}
});
}
return BannerConfig(
hideCloseButton: json['hide_close_button'],
hideAcceptButton: json['hide_accept_toggle'],
embedDSRPortalLink: json['embed_dsr_portal_link'],
recordConsentUponAppStart: json['record_consent_upon_app_start'],
hideToggleForEssentialCategories: json['hide_toggle_for_essential_categories'],
name: json['name'],
dsrPortalLink: json['dsr_portal_link'],
complianceType: json['compliance_type'] != null
? ComplianceType.fromString(json['compliance_type'])
: null,
bannerReappearanceTime: json['banner_reappearance_time'],
privacyNoticeLink: json['privacy_notice_link'],
accept: acceptMap,
reject: rejectMap,
bannerText: bannerTextMap,
bannerHeading: bannerHeadingMap,
sdkTabHeading: sdkTabHeadingMap,
privacyNoticeText: privacyNoticeTextMap,
preferenceCenterLink: preferenceCenterLinkMap,
permissionsTabHeading: permissionsTabHeadingMap,
permissionsTabGuidance: permissionsTabGuidanceMap,
preferenceCenterHeading: preferenceCenterHeadingMap,
preferenceCenterGuidance: preferenceCenterGuidanceMap,
permissionsTabDescription: permissionsTabDescriptionMap,
preferenceCenterDescription: preferenceCenterDescriptionMap,
showPoweredBySecuritiLogo: json['show_powered_by_securiti_logo'],
showDescriptionTextWithPrefCenterToggle: json['show_description_text_with_preference_center_toggle'],
paletteTheme: json['palette_theme'],
bannerPosition: json['banner_position'] != null
? BannerPosition.fromString(json['banner_position'])
: null,
buttonShape: json['button_shape'] != null
? ButtonShape.fromString(json['button_shape'])
: null,
companyLogo: json['company_logo'],
customPaletteTheme: json['palette'] != null
? CustomColors.fromJson(json['palette'])
: null,
shouldShowSettingsPrompt: json['should_show_settings_prompt'],
translations: translationsMap,
);
}