118 lines
2.2 KiB
Dart
118 lines
2.2 KiB
Dart
class StatisticGeneralContent {
|
|
List<Content> contents;
|
|
int lastPage;
|
|
|
|
StatisticGeneralContent({required this.contents, required this.lastPage});
|
|
|
|
factory StatisticGeneralContent.fromJson(Map<String, dynamic> json) {
|
|
return StatisticGeneralContent(
|
|
contents:
|
|
List<Content>.from(json['contents'].map((x) => Content.fromJson(x))),
|
|
lastPage: json['lastPage'],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'contents': List<dynamic>.from(contents.map((x) => x.toJson())),
|
|
'lastPage': lastPage,
|
|
};
|
|
}
|
|
}
|
|
|
|
class Content {
|
|
final int id;
|
|
final String label;
|
|
final String title;
|
|
final int type;
|
|
final bool marked;
|
|
final Data data;
|
|
|
|
Content({
|
|
required this.id,
|
|
required this.label,
|
|
required this.title,
|
|
required this.type,
|
|
required this.marked,
|
|
required this.data,
|
|
});
|
|
|
|
factory Content.fromJson(Map<String, dynamic> json) {
|
|
return Content(
|
|
id: json['id'],
|
|
label: json['label'],
|
|
title: json['title'],
|
|
type: json['type'],
|
|
marked: json['marked'],
|
|
data: Data.fromJson(json['data']),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'label': label,
|
|
'title': title,
|
|
'type': type,
|
|
'marked': marked,
|
|
'data': data.toJson(),
|
|
};
|
|
}
|
|
}
|
|
|
|
class Data {
|
|
final String p;
|
|
final String h;
|
|
final String l;
|
|
final String d;
|
|
final double dp;
|
|
final String dt;
|
|
final String t;
|
|
final String tEn;
|
|
final String tG;
|
|
final String ts;
|
|
|
|
Data({
|
|
required this.p,
|
|
required this.h,
|
|
required this.l,
|
|
required this.d,
|
|
required this.dp,
|
|
required this.dt,
|
|
required this.t,
|
|
required this.tEn,
|
|
required this.tG,
|
|
required this.ts,
|
|
});
|
|
|
|
factory Data.fromJson(Map<String, dynamic> json) {
|
|
return Data(
|
|
p: json['p'],
|
|
h: json['h'],
|
|
l: json['l'],
|
|
d: json['d'],
|
|
dp: json['dp'].toDouble(), // Ensuring correct type
|
|
dt: json['dt'],
|
|
t: json['t'],
|
|
tEn: json['t_en'],
|
|
tG: json['t-g'],
|
|
ts: json['ts'],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'p': p,
|
|
'h': h,
|
|
'l': l,
|
|
'd': d,
|
|
'dp': dp,
|
|
'dt': dt,
|
|
't': t,
|
|
't_en': tEn,
|
|
't-g': tG,
|
|
'ts': ts,
|
|
};
|
|
}
|
|
}
|