didvan-app/lib/models/infography/infography_content.dart

61 lines
1.3 KiB
Dart

class InfographyContent {
final List<Content> contents;
final int lastPage;
InfographyContent({required this.contents, required this.lastPage});
factory InfographyContent.fromJson(Map<String, dynamic> json) {
return InfographyContent(
contents:
List<Content>.from(json['contents'].map((x) => Content.fromJson(x))),
lastPage: json['lastPage'],
);
}
}
class Content {
final int id;
final String title;
final String image;
final String category;
final String createdAt;
final bool marked;
final List<Tag> tags;
Content(
{required this.id,
required this.marked,
required this.createdAt,
required this.title,
required this.image,
required this.category,
required this.tags});
factory Content.fromJson(Map<String, dynamic> json) {
return Content(
id: json['id'],
marked: json['marked'],
createdAt: json['createdAt'],
title: json['title'],
image: json['image'],
category: json['category'],
tags: List<Tag>.from(json['tags'].map((x) => Tag.fromJson(x))),
);
}
}
class Tag {
final int id;
final String label;
Tag({required this.id, required this.label});
factory Tag.fromJson(Map<String, dynamic> json) {
return Tag(
id: json['id'],
label: json['label'],
);
}
}