发现页面

This commit is contained in:
2022-10-27 10:43:44 +08:00
parent 93f41b091f
commit aa30a11af2
6 changed files with 31 additions and 24 deletions

View File

@@ -10,10 +10,10 @@ class MomentModel {
List<MomentItemModel>? data;
PageModel? page;
factory MomentModel.fromMap(Map<String, dynamic> json) => MomentModel(
factory MomentModel.fromJson(Map<String, dynamic> json) => MomentModel(
data: List<MomentItemModel>.from(
json['data'].map(
(x) => MomentItemModel.fromMap(x),
(x) => MomentItemModel.fromJson(x),
),
),
page: PageModel.fromJson(json['page']),
@@ -47,7 +47,8 @@ class MomentItemModel {
String? createdAt;
String? time;
factory MomentItemModel.fromMap(Map<String, dynamic> json) => MomentItemModel(
factory MomentItemModel.fromJson(Map<String, dynamic> json) =>
MomentItemModel(
dynamicId: json['dynamic_id'],
user: UserInfoModel.fromJson(json['user']),
description: json['description'],
@@ -57,8 +58,8 @@ class MomentItemModel {
likerCount: json['liker_count'],
liker: List<UserInfoModel>.from(
json['liker'].map((x) => UserInfoModel.fromJson(x))),
comments:
List<Comment>.from(json['comments'].map((x) => Comment.fromMap(x))),
comments: List<Comment>.from(
json['comments'].map((x) => Comment.fromJson(x))),
createdAt: json['created_at'],
time: json['time'],
);
@@ -79,7 +80,7 @@ class Comment {
String? content;
bool isMe;
factory Comment.fromMap(Map<String, dynamic> json) => Comment(
factory Comment.fromJson(Map<String, dynamic> json) => Comment(
id: json['comment_id'],
parent: json['parent'] == null
? null