added ad provider

This commit is contained in:
Kima
2023-09-05 18:49:14 +02:00
parent fceb4e050f
commit a5a43ea0b9
13 changed files with 217 additions and 7 deletions

View File

@@ -0,0 +1,29 @@
class Ad {
String title;
String description;
String author;
Uri? logoUrl;
bool overridePremium;
DateTime date;
Ad({
required this.title,
required this.description,
required this.author,
required this.logoUrl,
this.overridePremium = false,
required this.date,
});
factory Ad.fromJson(Map json) {
return Ad(
title: json['title'] ?? 'Ad',
description: json['description'] ?? '',
author: json['author'] ?? 'reFilc',
logoUrl: json['logo_url'] != null ? Uri.parse(json['logo_url']) : null,
overridePremium: json['override_premium'] ?? false,
date:
json['date'] != null ? DateTime.parse(json['date']) : DateTime.now(),
);
}
}