feat:增加博客卡片内容
This commit is contained in:
62
lib/models/blog.dart
Normal file
62
lib/models/blog.dart
Normal file
@@ -0,0 +1,62 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
// flutter pub run build_runner build
|
||||
part 'blog.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Blog {
|
||||
@JsonKey(name: 'id')
|
||||
final int id;
|
||||
|
||||
@JsonKey(name: 'title')
|
||||
final String title;
|
||||
|
||||
@JsonKey(name: 'topValue')
|
||||
final int topValue;
|
||||
|
||||
@JsonKey(name: 'isGreat')
|
||||
final bool isGreat;
|
||||
|
||||
@JsonKey(name: 'category')
|
||||
final String category;
|
||||
|
||||
@JsonKey(name: 'summary')
|
||||
final String summary;
|
||||
|
||||
@JsonKey(name: 'content')
|
||||
final String? content;
|
||||
|
||||
@JsonKey(name: 'wordCount')
|
||||
final int wordCount;
|
||||
|
||||
@JsonKey(name: 'readDuration')
|
||||
final int readDuration;
|
||||
|
||||
@JsonKey(name: 'visitCount')
|
||||
final int visitCount;
|
||||
|
||||
@JsonKey(name: 'createTime')
|
||||
final String createTime;
|
||||
|
||||
@JsonKey(name: 'updateTime')
|
||||
final String updateTime;
|
||||
|
||||
Blog({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.topValue,
|
||||
required this.isGreat,
|
||||
required this.category,
|
||||
required this.summary,
|
||||
this.content,
|
||||
required this.wordCount,
|
||||
required this.readDuration,
|
||||
required this.visitCount,
|
||||
required this.createTime,
|
||||
required this.updateTime,
|
||||
});
|
||||
|
||||
factory Blog.fromJson(Map<String, dynamic> json) => _$BlogFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$BlogToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user