first commit
This commit is contained in:
1
滴滴淘/ddt_flutter/lib/model/.pydio
Normal file
1
滴滴淘/ddt_flutter/lib/model/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
983f8dc4-232f-4709-9b17-c4279f8f0f14
|
||||
40
滴滴淘/ddt_flutter/lib/model/ImageModel.dart
Executable file
40
滴滴淘/ddt_flutter/lib/model/ImageModel.dart
Executable file
@@ -0,0 +1,40 @@
|
||||
class StyleModel {
|
||||
final int status;
|
||||
final int length;
|
||||
final String copyright;
|
||||
final List<Infos> data;
|
||||
|
||||
StyleModel({ this.status, this.length, this.copyright, this.data });
|
||||
|
||||
factory StyleModel.fromJson(Map<String, dynamic> parsedJson){
|
||||
var list = parsedJson['data'] as List;
|
||||
List<Infos> imageinfo = list.map((i) => Infos.fromJson(i)).toList();
|
||||
return StyleModel(
|
||||
status: parsedJson['status'],
|
||||
length: parsedJson['name'],
|
||||
copyright: parsedJson['copyright'],
|
||||
data: imageinfo,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Infos {
|
||||
final String title;
|
||||
final String imgurl;
|
||||
final String href;
|
||||
final String view;
|
||||
final String comments;
|
||||
|
||||
Infos({ this.title, this.imgurl, this.href, this.view, this.comments });
|
||||
|
||||
factory Infos.fromJson(Map<String, dynamic> parsedJson){
|
||||
return Infos(
|
||||
title: parsedJson['title'] as String,
|
||||
imgurl: parsedJson['imgurl'] as String,
|
||||
href: parsedJson['href'] as String,
|
||||
view: parsedJson['view'] as String,
|
||||
comments: parsedJson['comments'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
44
滴滴淘/ddt_flutter/lib/model/IndexModel.dart
Normal file
44
滴滴淘/ddt_flutter/lib/model/IndexModel.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
class Index {
|
||||
int status;
|
||||
List<Body> body;
|
||||
|
||||
Index({this.status, this.body});
|
||||
|
||||
Index.fromJson(Map<String, dynamic> json) {
|
||||
status = json['status'];
|
||||
if (json['body'] != null) {
|
||||
body = new List<Body>();
|
||||
json['body'].forEach((v) {
|
||||
body.add(new Body.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['status'] = this.status;
|
||||
if (this.body != null) {
|
||||
data['body'] = this.body.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Body {
|
||||
int id;
|
||||
String text;
|
||||
|
||||
Body({this.id, this.text});
|
||||
|
||||
Body.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
text = json['text'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['text'] = this.text;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
3
滴滴淘/ddt_flutter/lib/model/help.md
Executable file
3
滴滴淘/ddt_flutter/lib/model/help.md
Executable file
@@ -0,0 +1,3 @@
|
||||
# JSON数据序列化
|
||||
|
||||
序列化的数据和接口数据返回的格式进行对应
|
||||
Reference in New Issue
Block a user