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,
};
}