feat:增加朋友圈组件
This commit is contained in:
53
lib/models/moment.dart
Normal file
53
lib/models/moment.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'moment.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Comment {
|
||||
final int id;
|
||||
final String username;
|
||||
final String avatar;
|
||||
final String content;
|
||||
final String date;
|
||||
|
||||
const Comment({
|
||||
required this.id,
|
||||
required this.username,
|
||||
required this.avatar,
|
||||
required this.content,
|
||||
required this.date,
|
||||
});
|
||||
|
||||
factory Comment.fromJson(Map<String, dynamic> json) => _$CommentFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$CommentToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class Moment {
|
||||
final int? id;
|
||||
final int? userId;
|
||||
final String? username;
|
||||
final String? avatar;
|
||||
final String content;
|
||||
final List<String> imageList;
|
||||
final String? date;
|
||||
final List<int>? likeList;
|
||||
final List<Comment>? commentList;
|
||||
|
||||
Moment({
|
||||
this.id,
|
||||
this.userId,
|
||||
this.username,
|
||||
this.avatar,
|
||||
required this.content,
|
||||
required this.imageList,
|
||||
this.date,
|
||||
this.likeList,
|
||||
this.commentList,
|
||||
});
|
||||
|
||||
factory Moment.fromJson(Map<String, dynamic> json) => _$MomentFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$MomentToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user