|
|
|
|
@ -39,8 +39,21 @@ class OccasionConfigModel {
|
|
|
|
|
|
|
|
|
|
/// Remote (or bundled asset path) image rendered as the occasion's main
|
|
|
|
|
/// header/banner (e.g. the National Day greeting banner), drawn at full
|
|
|
|
|
/// opacity on top of [backgroundOpacityImage].
|
|
|
|
|
final String? headerImage;
|
|
|
|
|
/// opacity on top of [backgroundOpacityImage]. Language-specific — pick
|
|
|
|
|
/// [headerImageEn] or [headerImageAr] based on the app's current locale
|
|
|
|
|
/// (the model itself doesn't know about locale).
|
|
|
|
|
///
|
|
|
|
|
/// Note: the remote JSON also still publishes a legacy `header_image` key
|
|
|
|
|
/// (mirrored to the English image) purely so old app versions that only
|
|
|
|
|
/// know that single key keep showing *a* banner until they update — this
|
|
|
|
|
/// model intentionally does not read that legacy key at all.
|
|
|
|
|
final String? headerImageEn;
|
|
|
|
|
final String? headerImageAr;
|
|
|
|
|
|
|
|
|
|
/// Redirection link opened when the corresponding header banner is
|
|
|
|
|
/// tapped. Null/empty means "do nothing" — the tap has no effect.
|
|
|
|
|
final String? headerImageLinkEn;
|
|
|
|
|
final String? headerImageLinkAr;
|
|
|
|
|
|
|
|
|
|
const OccasionConfigModel({
|
|
|
|
|
required this.key,
|
|
|
|
|
@ -50,7 +63,10 @@ class OccasionConfigModel {
|
|
|
|
|
this.primaryColorHex,
|
|
|
|
|
this.backgroundOpacityImage,
|
|
|
|
|
this.backgroundImageOpacity = 1.0,
|
|
|
|
|
this.headerImage,
|
|
|
|
|
this.headerImageEn,
|
|
|
|
|
this.headerImageAr,
|
|
|
|
|
this.headerImageLinkEn,
|
|
|
|
|
this.headerImageLinkAr,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/// Fully inert config — identical to the app's current/default look.
|
|
|
|
|
@ -62,20 +78,25 @@ class OccasionConfigModel {
|
|
|
|
|
primaryColorHex: null,
|
|
|
|
|
backgroundOpacityImage: null,
|
|
|
|
|
backgroundImageOpacity: 1.0,
|
|
|
|
|
headerImage: null,
|
|
|
|
|
headerImageEn: null,
|
|
|
|
|
headerImageAr: null,
|
|
|
|
|
headerImageLinkEn: null,
|
|
|
|
|
headerImageLinkAr: null,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
factory OccasionConfigModel.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
return OccasionConfigModel(
|
|
|
|
|
key: (json['key'] as String?) ?? 'none',
|
|
|
|
|
enabled: (json['enabled'] as bool?) ?? false,
|
|
|
|
|
// enabled: true,
|
|
|
|
|
startDate: _parseDate(json['start_date']),
|
|
|
|
|
endDate: _parseDate(json['end_date']),
|
|
|
|
|
primaryColorHex: json['primary_color'] as String?,
|
|
|
|
|
backgroundOpacityImage: json['background_opacity_image'] as String?,
|
|
|
|
|
backgroundImageOpacity: (json['background_image_opacity'] as num?)?.toDouble() ?? 1.0,
|
|
|
|
|
headerImage: json['header_image'] as String?,
|
|
|
|
|
headerImageEn: json['header_image_en'] as String?,
|
|
|
|
|
headerImageAr: json['header_image_ar'] as String?,
|
|
|
|
|
headerImageLinkEn: json['header_image_link_en'] as String?,
|
|
|
|
|
headerImageLinkAr: json['header_image_link_ar'] as String?,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -142,6 +163,11 @@ class OccasionConfigModel {
|
|
|
|
|
'primary_color': primaryColorHex,
|
|
|
|
|
'background_opacity_image': backgroundOpacityImage,
|
|
|
|
|
'background_image_opacity': backgroundImageOpacity,
|
|
|
|
|
'header_image': headerImage,
|
|
|
|
|
// Legacy key for old app versions — see [headerImageEn] doc comment.
|
|
|
|
|
'header_image': headerImageEn,
|
|
|
|
|
'header_image_en': headerImageEn,
|
|
|
|
|
'header_image_ar': headerImageAr,
|
|
|
|
|
'header_image_link_en': headerImageLinkEn,
|
|
|
|
|
'header_image_link_ar': headerImageLinkAr,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|