feat: dyn topic

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-07 17:27:07 +08:00
parent dd6ff101d1
commit 11a0f2faca
21 changed files with 635 additions and 207 deletions

View File

@@ -0,0 +1,16 @@
class AllSortBy {
int? sortBy;
String? sortName;
AllSortBy({this.sortBy, this.sortName});
factory AllSortBy.fromJson(Map<String, dynamic> json) => AllSortBy(
sortBy: json['sort_by'] as int?,
sortName: json['sort_name'] as String?,
);
Map<String, dynamic> toJson() => {
'sort_by': sortBy,
'sort_name': sortName,
};
}

View File

@@ -0,0 +1,16 @@
import 'package:PiliPlus/models/dynamics/result.dart';
class TopicCardItem {
DynamicItemModel? dynamicCardItem;
String? topicType;
TopicCardItem({this.dynamicCardItem, this.topicType});
factory TopicCardItem.fromJson(Map<String, dynamic> json) => TopicCardItem(
dynamicCardItem: json['dynamic_card_item'] == null
? null
: DynamicItemModel.fromJson(
json['dynamic_card_item'] as Map<String, dynamic>),
topicType: json['topic_type'] as String?,
);
}

View File

@@ -0,0 +1,28 @@
import 'package:PiliPlus/models/dynamics/dyn_topic_feed/item.dart';
import 'package:PiliPlus/models/dynamics/dyn_topic_feed/topic_sort_by_conf.dart';
class TopicCardList {
bool? hasMore;
List<TopicCardItem>? items;
String? offset;
TopicSortByConf? topicSortByConf;
TopicCardList({
this.hasMore,
this.items,
this.offset,
this.topicSortByConf,
});
factory TopicCardList.fromJson(Map<String, dynamic> json) => TopicCardList(
hasMore: json['has_more'] as bool?,
items: (json['items'] as List<dynamic>?)
?.map((e) => TopicCardItem.fromJson(e as Map<String, dynamic>))
.toList(),
offset: json['offset'] as String?,
topicSortByConf: json['topic_sort_by_conf'] == null
? null
: TopicSortByConf.fromJson(
json['topic_sort_by_conf'] as Map<String, dynamic>),
);
}

View File

@@ -0,0 +1,25 @@
import 'package:PiliPlus/models/dynamics/dyn_topic_feed/all_sort_by.dart';
class TopicSortByConf {
List<AllSortBy>? allSortBy;
int? defaultSortBy;
int? showSortBy;
TopicSortByConf({this.allSortBy, this.defaultSortBy, this.showSortBy});
factory TopicSortByConf.fromJson(Map<String, dynamic> json) {
return TopicSortByConf(
allSortBy: (json['all_sort_by'] as List<dynamic>?)
?.map((e) => AllSortBy.fromJson(e as Map<String, dynamic>))
.toList(),
defaultSortBy: json['default_sort_by'] as int?,
showSortBy: json['show_sort_by'] as int?,
);
}
Map<String, dynamic> toJson() => {
'all_sort_by': allSortBy?.map((e) => e.toJson()).toList(),
'default_sort_by': defaultSortBy,
'show_sort_by': showSortBy,
};
}

View File

@@ -0,0 +1,39 @@
import 'package:PiliPlus/models/dynamics/dyn_topic_top/topic_creator.dart';
import 'package:PiliPlus/models/dynamics/dyn_topic_top/topic_item.dart';
class TopDetails {
TopicItem? topicItem;
TopicCreator? topicCreator;
bool? hasCreateJurisdiction;
int? wordColor;
bool? closePubLayerEntry;
TopDetails({
this.topicItem,
this.topicCreator,
this.hasCreateJurisdiction,
this.wordColor,
this.closePubLayerEntry,
});
factory TopDetails.fromJson(Map<String, dynamic> json) => TopDetails(
topicItem: json['topic_item'] == null
? null
: TopicItem.fromJson(json['topic_item'] as Map<String, dynamic>),
topicCreator: json['topic_creator'] == null
? null
: TopicCreator.fromJson(
json['topic_creator'] as Map<String, dynamic>),
hasCreateJurisdiction: json['has_create_jurisdiction'] as bool?,
wordColor: json['word_color'] as int?,
closePubLayerEntry: json['close_pub_layer_entry'] as bool?,
);
Map<String, dynamic> toJson() => {
'topic_item': topicItem?.toJson(),
'topic_creator': topicCreator?.toJson(),
'has_create_jurisdiction': hasCreateJurisdiction,
'word_color': wordColor,
'close_pub_layer_entry': closePubLayerEntry,
};
}

View File

@@ -0,0 +1,23 @@
class TopicCreator {
int? uid;
String? face;
String? name;
TopicCreator({
this.uid,
this.face,
this.name,
});
factory TopicCreator.fromJson(Map<String, dynamic> json) => TopicCreator(
uid: json['uid'] as int?,
face: json['face'] as String?,
name: json['name'] as String?,
);
Map<String, dynamic> toJson() => {
'uid': uid,
'face': face,
'name': name,
};
}

View File

@@ -0,0 +1,63 @@
class TopicItem {
int? id;
String? name;
int? view;
int? discuss;
int? fav;
int? dynamics;
String? jumpUrl;
String? backColor;
String? description;
String? sharePic;
String? shareUrl;
int? ctime;
bool? showInteractData;
TopicItem({
this.id,
this.name,
this.view,
this.discuss,
this.fav,
this.dynamics,
this.jumpUrl,
this.backColor,
this.description,
this.sharePic,
this.shareUrl,
this.ctime,
this.showInteractData,
});
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?,
dynamics: json['dynamics'] as int?,
jumpUrl: json['jump_url'] as String?,
backColor: json['back_color'] as String?,
description: json['description'] as String?,
sharePic: json['share_pic'] as String?,
shareUrl: json['share_url'] as String?,
ctime: json['ctime'] as int?,
showInteractData: json['show_interact_data'] as bool?,
);
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'view': view,
'discuss': discuss,
'fav': fav,
'dynamics': dynamics,
'jump_url': jumpUrl,
'back_color': backColor,
'description': description,
'share_pic': sharePic,
'share_url': shareUrl,
'ctime': ctime,
'show_interact_data': showInteractData,
};
}