mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-24 02:56:58 +08:00
feat: dyn topic
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
16
lib/models/dynamics/dyn_topic_feed/all_sort_by.dart
Normal file
16
lib/models/dynamics/dyn_topic_feed/all_sort_by.dart
Normal 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,
|
||||
};
|
||||
}
|
||||
16
lib/models/dynamics/dyn_topic_feed/item.dart
Normal file
16
lib/models/dynamics/dyn_topic_feed/item.dart
Normal 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?,
|
||||
);
|
||||
}
|
||||
28
lib/models/dynamics/dyn_topic_feed/topic_card_list.dart
Normal file
28
lib/models/dynamics/dyn_topic_feed/topic_card_list.dart
Normal 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>),
|
||||
);
|
||||
}
|
||||
25
lib/models/dynamics/dyn_topic_feed/topic_sort_by_conf.dart
Normal file
25
lib/models/dynamics/dyn_topic_feed/topic_sort_by_conf.dart
Normal 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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user