-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIndexPageBannerBean.dart
67 lines (45 loc) · 1.65 KB
/
IndexPageBannerBean.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import 'dart:convert' show json;
class IndexPageBannerBean {
int errorCode;
String errorMsg;
List<BannerChildBean> data;
IndexPageBannerBean.fromParams({this.errorCode, this.errorMsg, this.data});
factory IndexPageBannerBean(jsonStr) => jsonStr is String ? IndexPageBannerBean.fromJson(json.decode(jsonStr)) : IndexPageBannerBean.fromJson(jsonStr);
IndexPageBannerBean.fromJson(jsonRes) {
errorCode = jsonRes['errorCode'];
errorMsg = jsonRes['errorMsg'];
data = [];
for (var dataItem in jsonRes['data']){
data.add(new BannerChildBean.fromJson(dataItem));
}
}
@override
String toString() {
return '{"errorCode": $errorCode,"errorMsg": ${errorMsg != null?'${json.encode(errorMsg)}':'null'},"data": $data}';
}
}
class BannerChildBean {
int id;
int isVisible;
int order;
int type;
String desc;
String imagePath;
String title;
String url;
BannerChildBean.fromParams({this.id, this.isVisible, this.order, this.type, this.desc, this.imagePath, this.title, this.url});
BannerChildBean.fromJson(jsonRes) {
id = jsonRes['id'];
isVisible = jsonRes['isVisible'];
order = jsonRes['order'];
type = jsonRes['type'];
desc = jsonRes['desc'];
imagePath = jsonRes['imagePath'];
title = jsonRes['title'];
url = jsonRes['url'];
}
@override
String toString() {
return '{"id": $id,"isVisible": $isVisible,"order": $order,"type": $type,"desc": ${desc != null?'${json.encode(desc)}':'null'},"imagePath": ${imagePath != null?'${json.encode(imagePath)}':'null'},"title": ${title != null?'${json.encode(title)}':'null'},"url": ${url != null?'${json.encode(url)}':'null'}}';
}
}