99 lines
2.3 KiB
Dart
99 lines
2.3 KiB
Dart
class TranslationModel {
|
|
final int id;
|
|
final String language;
|
|
final String title;
|
|
final String? markdown;
|
|
|
|
TranslationModel({
|
|
required this.id,
|
|
required this.language,
|
|
required this.title,
|
|
this.markdown,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'language': language,
|
|
'title': title,
|
|
'markdown': markdown,
|
|
};
|
|
}
|
|
factory TranslationModel.fromJson(Map<String, dynamic> json) {
|
|
return TranslationModel(
|
|
id: json['id'] ?? 0,
|
|
language: json['language'] ?? '',
|
|
title: json['title'] ?? '',
|
|
markdown: json['markdown'] ?? '',
|
|
);
|
|
}
|
|
}
|
|
|
|
class ConferencesModel {
|
|
|
|
final int id;
|
|
final String title;
|
|
final DateTime date;
|
|
int activity;
|
|
int duration;
|
|
String place;
|
|
String city;
|
|
String state;
|
|
String country;
|
|
// List<String> type;
|
|
String thumbnail;
|
|
List<TranslationModel> translations;
|
|
|
|
ConferencesModel({
|
|
required this.id,
|
|
required this.title,
|
|
required this.date,
|
|
this.activity = 0,
|
|
this.duration = 0,
|
|
this.place = '',
|
|
this.city = '',
|
|
this.state = '',
|
|
this.country = '',
|
|
// this.type = const [],
|
|
this.thumbnail = '',
|
|
this.translations = const [],
|
|
});
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'title': title,
|
|
'date': date.toIso8601String(),
|
|
'activity': activity,
|
|
'duration': duration,
|
|
'place': place,
|
|
'city': city,
|
|
'state': state,
|
|
'country': country,
|
|
// 'type': type,
|
|
'thumbnail': thumbnail.toString(),
|
|
'translations': translations.toString() ,
|
|
};
|
|
}
|
|
|
|
factory ConferencesModel.fromJson(Map<String, dynamic> json) {
|
|
return ConferencesModel(
|
|
id: json['id'] ?? 0,
|
|
title: json['title'] ?? '',
|
|
date: json['date'] != null ? DateTime.parse(json['date'].toString()) : DateTime.now(),
|
|
activity: json['activity'] ?? 0,
|
|
duration: json['duration'] ?? 0,
|
|
place: json['place'] ?? '',
|
|
city: json['city'] ?? '',
|
|
state: json['state'] ?? '',
|
|
country: json['country'] ?? '',
|
|
// type: List<String>.from(json['type'] ?? []),
|
|
thumbnail: json['thumbnail'] ?? '',
|
|
translations: (json['translations'] as List<dynamic>?)
|
|
?.map((item) => TranslationModel.fromJson(item as Map<String, dynamic>))
|
|
.toList() ?? [],
|
|
);
|
|
|
|
}
|
|
}
|