发现页面
This commit is contained in:
91
lib/models/moment/moment_model.dart
Normal file
91
lib/models/moment/moment_model.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
import 'package:chat/models/page_model.dart';
|
||||
import 'package:chat/models/user_info_model.dart';
|
||||
|
||||
class MomentModel {
|
||||
MomentModel({
|
||||
this.data,
|
||||
this.page,
|
||||
});
|
||||
|
||||
List<MomentItemModel>? data;
|
||||
PageModel? page;
|
||||
|
||||
factory MomentModel.fromMap(Map<String, dynamic> json) => MomentModel(
|
||||
data: List<MomentItemModel>.from(
|
||||
json['data'].map(
|
||||
(x) => MomentItemModel.fromMap(x),
|
||||
),
|
||||
),
|
||||
page: PageModel.fromJson(json['page']),
|
||||
);
|
||||
}
|
||||
|
||||
class MomentItemModel {
|
||||
MomentItemModel({
|
||||
this.dynamicId,
|
||||
this.user,
|
||||
this.description,
|
||||
this.pictures,
|
||||
this.isLike,
|
||||
this.isMe,
|
||||
this.likerCount,
|
||||
this.liker,
|
||||
this.comments,
|
||||
this.createdAt,
|
||||
this.time,
|
||||
});
|
||||
|
||||
int? dynamicId;
|
||||
UserInfoModel? user;
|
||||
String? description;
|
||||
bool? isLike;
|
||||
bool? isMe;
|
||||
int? likerCount;
|
||||
List<String>? pictures;
|
||||
List<UserInfoModel>? liker;
|
||||
List<Comment>? comments;
|
||||
String? createdAt;
|
||||
String? time;
|
||||
|
||||
factory MomentItemModel.fromMap(Map<String, dynamic> json) => MomentItemModel(
|
||||
dynamicId: json['dynamic_id'],
|
||||
user: UserInfoModel.fromJson(json['user']),
|
||||
description: json['description'],
|
||||
pictures: List<String>.from(json['pictures'].map((x) => x)),
|
||||
isLike: json['is_like'],
|
||||
isMe: json['is_me'],
|
||||
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))),
|
||||
createdAt: json['created_at'],
|
||||
time: json['time'],
|
||||
);
|
||||
}
|
||||
|
||||
class Comment {
|
||||
Comment({
|
||||
this.id,
|
||||
this.user,
|
||||
this.parent,
|
||||
this.content,
|
||||
required this.isMe,
|
||||
});
|
||||
|
||||
int? id;
|
||||
UserInfoModel? user;
|
||||
UserInfoModel? parent;
|
||||
String? content;
|
||||
bool isMe;
|
||||
|
||||
factory Comment.fromMap(Map<String, dynamic> json) => Comment(
|
||||
id: json['comment_id'],
|
||||
parent: json['parent'] == null
|
||||
? null
|
||||
: UserInfoModel.fromJson(json['parent']),
|
||||
user: UserInfoModel.fromJson(json['user']),
|
||||
content: json['content'],
|
||||
isMe: json['is_me'],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user