feat:增加博客搜索功能
This commit is contained in:
@@ -107,3 +107,30 @@ class BlogStats {
|
||||
|
||||
Map<String, dynamic> toJson() => _$BlogStatsToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(genericArgumentFactories: true)
|
||||
class BlogSearch {
|
||||
@JsonKey(name: 'id')
|
||||
final int id;
|
||||
|
||||
@JsonKey(name: 'title')
|
||||
final String title;
|
||||
|
||||
@JsonKey(name: 'content')
|
||||
final String content;
|
||||
|
||||
@JsonKey(name: 'highlight')
|
||||
final String highlight;
|
||||
|
||||
const BlogSearch({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.content,
|
||||
required this.highlight,
|
||||
});
|
||||
|
||||
factory BlogSearch.fromJson(Map<String, dynamic> json) =>
|
||||
_$BlogSearchFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$BlogSearchToJson(this);
|
||||
}
|
||||
|
||||
@@ -59,3 +59,18 @@ Map<String, dynamic> _$BlogStatsToJson(BlogStats instance) => <String, dynamic>{
|
||||
'visitCount': instance.visitCount,
|
||||
'wordCount': instance.wordCount,
|
||||
};
|
||||
|
||||
BlogSearch _$BlogSearchFromJson(Map<String, dynamic> json) => BlogSearch(
|
||||
id: (json['id'] as num).toInt(),
|
||||
title: json['title'] as String,
|
||||
content: json['content'] as String,
|
||||
highlight: json['highlight'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$BlogSearchToJson(BlogSearch instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'title': instance.title,
|
||||
'content': instance.content,
|
||||
'highlight': instance.highlight,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user