mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-21 16:48:43 +00:00
feat: fav topic
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:PiliPlus/pages/fav/article/view.dart';
|
||||
import 'package:PiliPlus/pages/fav/note/view.dart';
|
||||
import 'package:PiliPlus/pages/fav/pgc/view.dart';
|
||||
import 'package:PiliPlus/pages/fav/topic/view.dart';
|
||||
import 'package:PiliPlus/pages/fav/video/view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -9,7 +10,8 @@ enum FavTabType {
|
||||
bangumi('追番', FavPgcPage(type: 1)),
|
||||
cinema('追剧', FavPgcPage(type: 2)),
|
||||
article('专栏', FavArticlePage()),
|
||||
note('笔记', FavNotePage());
|
||||
note('笔记', FavNotePage()),
|
||||
topic('话题', FavTopicPage());
|
||||
|
||||
final String title;
|
||||
final Widget page;
|
||||
|
||||
@@ -3,7 +3,8 @@ class TopicItem {
|
||||
String? name;
|
||||
int? view;
|
||||
int? discuss;
|
||||
int? fav;
|
||||
late int fav;
|
||||
late int like;
|
||||
int? dynamics;
|
||||
String? jumpUrl;
|
||||
String? backColor;
|
||||
@@ -12,13 +13,16 @@ class TopicItem {
|
||||
String? shareUrl;
|
||||
int? ctime;
|
||||
bool? showInteractData;
|
||||
bool? isFav;
|
||||
bool? isLike;
|
||||
|
||||
TopicItem({
|
||||
this.id,
|
||||
this.name,
|
||||
this.view,
|
||||
this.discuss,
|
||||
this.fav,
|
||||
required this.fav,
|
||||
required this.like,
|
||||
this.dynamics,
|
||||
this.jumpUrl,
|
||||
this.backColor,
|
||||
@@ -27,14 +31,17 @@ class TopicItem {
|
||||
this.shareUrl,
|
||||
this.ctime,
|
||||
this.showInteractData,
|
||||
this.isFav,
|
||||
this.isLike,
|
||||
});
|
||||
|
||||
factory TopicItem.fromJson(Map<String, dynamic> json) => TopicItem(
|
||||
id: json['id'] as int?,
|
||||
name: json['name'] as String?,
|
||||
view: json['view'] as int?,
|
||||
discuss: json['discuss'] as int?,
|
||||
fav: json['fav'] as int?,
|
||||
view: json['view'] as int? ?? 0,
|
||||
discuss: json['discuss'] as int? ?? 0,
|
||||
fav: json['fav'] as int? ?? 0,
|
||||
like: json['like'] as int? ?? 0,
|
||||
dynamics: json['dynamics'] as int?,
|
||||
jumpUrl: json['jump_url'] as String?,
|
||||
backColor: json['back_color'] as String?,
|
||||
@@ -43,6 +50,8 @@ class TopicItem {
|
||||
shareUrl: json['share_url'] as String?,
|
||||
ctime: json['ctime'] as int?,
|
||||
showInteractData: json['show_interact_data'] as bool?,
|
||||
isFav: json['is_fav'] as bool?,
|
||||
isLike: json['is_like'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
|
||||
17
lib/models/fav_topic/data.dart
Normal file
17
lib/models/fav_topic/data.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:PiliPlus/models/user/fav_topic/topic_list.dart';
|
||||
|
||||
class FavTopicData {
|
||||
TopicList? topicList;
|
||||
|
||||
FavTopicData({this.topicList});
|
||||
|
||||
factory FavTopicData.fromJson(Map<String, dynamic> json) => FavTopicData(
|
||||
topicList: json['topic_list'] == null
|
||||
? null
|
||||
: TopicList.fromJson(json['topic_list'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'topic_list': topicList?.toJson(),
|
||||
};
|
||||
}
|
||||
26
lib/models/fav_topic/fav_topic.dart
Normal file
26
lib/models/fav_topic/fav_topic.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:PiliPlus/models/fav_topic/data.dart';
|
||||
|
||||
class FavTopic {
|
||||
int? code;
|
||||
String? message;
|
||||
int? ttl;
|
||||
FavTopicData? data;
|
||||
|
||||
FavTopic({this.code, this.message, this.ttl, this.data});
|
||||
|
||||
factory FavTopic.fromJson(Map<String, dynamic> json) => FavTopic(
|
||||
code: json['code'] as int?,
|
||||
message: json['message'] as String?,
|
||||
ttl: json['ttl'] as int?,
|
||||
data: json['data'] == null
|
||||
? null
|
||||
: FavTopicData.fromJson(json['data'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'code': code,
|
||||
'message': message,
|
||||
'ttl': ttl,
|
||||
'data': data?.toJson(),
|
||||
};
|
||||
}
|
||||
16
lib/models/fav_topic/page_info.dart
Normal file
16
lib/models/fav_topic/page_info.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
class PageInfo {
|
||||
int? curPageNum;
|
||||
int? total;
|
||||
|
||||
PageInfo({this.curPageNum, this.total});
|
||||
|
||||
factory PageInfo.fromJson(Map<String, dynamic> json) => PageInfo(
|
||||
curPageNum: json['cur_page_num'] as int?,
|
||||
total: json['total'] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'cur_page_num': curPageNum,
|
||||
'total': total,
|
||||
};
|
||||
}
|
||||
39
lib/models/fav_topic/topic_item.dart
Normal file
39
lib/models/fav_topic/topic_item.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
class FavTopicModel {
|
||||
int? id;
|
||||
String? name;
|
||||
int? view;
|
||||
int? discuss;
|
||||
String? jumpUrl;
|
||||
String? statDesc;
|
||||
bool? showInteractData;
|
||||
|
||||
FavTopicModel({
|
||||
this.id,
|
||||
this.name,
|
||||
this.view,
|
||||
this.discuss,
|
||||
this.jumpUrl,
|
||||
this.statDesc,
|
||||
this.showInteractData,
|
||||
});
|
||||
|
||||
factory FavTopicModel.fromJson(Map<String, dynamic> json) => FavTopicModel(
|
||||
id: json['id'] as int?,
|
||||
name: json['name'] as String?,
|
||||
view: json['view'] as int?,
|
||||
discuss: json['discuss'] as int?,
|
||||
jumpUrl: json['jump_url'] as String?,
|
||||
statDesc: json['stat_desc'] as String?,
|
||||
showInteractData: json['show_interact_data'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'view': view,
|
||||
'discuss': discuss,
|
||||
'jump_url': jumpUrl,
|
||||
'stat_desc': statDesc,
|
||||
'show_interact_data': showInteractData,
|
||||
};
|
||||
}
|
||||
23
lib/models/fav_topic/topic_list.dart
Normal file
23
lib/models/fav_topic/topic_list.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:PiliPlus/models/user/fav_topic/page_info.dart';
|
||||
import 'package:PiliPlus/models/user/fav_topic/topic_item.dart';
|
||||
|
||||
class TopicList {
|
||||
List<FavTopicModel>? topicItems;
|
||||
PageInfo? pageInfo;
|
||||
|
||||
TopicList({this.topicItems, this.pageInfo});
|
||||
|
||||
factory TopicList.fromJson(Map<String, dynamic> json) => TopicList(
|
||||
topicItems: (json['topic_items'] as List<dynamic>?)
|
||||
?.map((e) => FavTopicModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
pageInfo: json['page_info'] == null
|
||||
? null
|
||||
: PageInfo.fromJson(json['page_info'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'topic_items': topicItems?.map((e) => e.toJson()).toList(),
|
||||
'page_info': pageInfo?.toJson(),
|
||||
};
|
||||
}
|
||||
17
lib/models/user/fav_topic/data.dart
Normal file
17
lib/models/user/fav_topic/data.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:PiliPlus/models/user/fav_topic/topic_list.dart';
|
||||
|
||||
class FavTopicData {
|
||||
TopicList? topicList;
|
||||
|
||||
FavTopicData({this.topicList});
|
||||
|
||||
factory FavTopicData.fromJson(Map<String, dynamic> json) => FavTopicData(
|
||||
topicList: json['topic_list'] == null
|
||||
? null
|
||||
: TopicList.fromJson(json['topic_list'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'topic_list': topicList?.toJson(),
|
||||
};
|
||||
}
|
||||
16
lib/models/user/fav_topic/page_info.dart
Normal file
16
lib/models/user/fav_topic/page_info.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
class PageInfo {
|
||||
int? curPageNum;
|
||||
int? total;
|
||||
|
||||
PageInfo({this.curPageNum, this.total});
|
||||
|
||||
factory PageInfo.fromJson(Map<String, dynamic> json) => PageInfo(
|
||||
curPageNum: json['cur_page_num'] as int?,
|
||||
total: json['total'] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'cur_page_num': curPageNum,
|
||||
'total': total,
|
||||
};
|
||||
}
|
||||
39
lib/models/user/fav_topic/topic_item.dart
Normal file
39
lib/models/user/fav_topic/topic_item.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
class FavTopicModel {
|
||||
int? id;
|
||||
String? name;
|
||||
int? view;
|
||||
int? discuss;
|
||||
String? jumpUrl;
|
||||
String? statDesc;
|
||||
bool? showInteractData;
|
||||
|
||||
FavTopicModel({
|
||||
this.id,
|
||||
this.name,
|
||||
this.view,
|
||||
this.discuss,
|
||||
this.jumpUrl,
|
||||
this.statDesc,
|
||||
this.showInteractData,
|
||||
});
|
||||
|
||||
factory FavTopicModel.fromJson(Map<String, dynamic> json) => FavTopicModel(
|
||||
id: json['id'] as int?,
|
||||
name: json['name'] as String?,
|
||||
view: json['view'] as int?,
|
||||
discuss: json['discuss'] as int?,
|
||||
jumpUrl: json['jump_url'] as String?,
|
||||
statDesc: json['stat_desc'] as String?,
|
||||
showInteractData: json['show_interact_data'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'view': view,
|
||||
'discuss': discuss,
|
||||
'jump_url': jumpUrl,
|
||||
'stat_desc': statDesc,
|
||||
'show_interact_data': showInteractData,
|
||||
};
|
||||
}
|
||||
23
lib/models/user/fav_topic/topic_list.dart
Normal file
23
lib/models/user/fav_topic/topic_list.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:PiliPlus/models/user/fav_topic/page_info.dart';
|
||||
import 'package:PiliPlus/models/user/fav_topic/topic_item.dart';
|
||||
|
||||
class TopicList {
|
||||
List<FavTopicModel>? topicItems;
|
||||
PageInfo? pageInfo;
|
||||
|
||||
TopicList({this.topicItems, this.pageInfo});
|
||||
|
||||
factory TopicList.fromJson(Map<String, dynamic> json) => TopicList(
|
||||
topicItems: (json['topic_items'] as List<dynamic>?)
|
||||
?.map((e) => FavTopicModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
pageInfo: json['page_info'] == null
|
||||
? null
|
||||
: PageInfo.fromJson(json['page_info'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'topic_items': topicItems?.map((e) => e.toJson()).toList(),
|
||||
'page_info': pageInfo?.toJson(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user