mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 18:16:54 +08:00
feat: space opus
Closes #833 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
31
lib/models/space/filter.dart
Normal file
31
lib/models/space/filter.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
class SpaceTabFilter {
|
||||
SpaceTabFilter({
|
||||
this.text,
|
||||
required this.meta,
|
||||
this.tabName,
|
||||
});
|
||||
|
||||
String? text;
|
||||
late String meta;
|
||||
String? tabName;
|
||||
|
||||
SpaceTabFilter.fromJson(Map<String, dynamic> json) {
|
||||
text = json['text'];
|
||||
meta = json['meta'] ?? 'all';
|
||||
tabName = json['tab_ame'];
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
if (other is SpaceTabFilter) {
|
||||
return meta == other.meta;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => meta.hashCode;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPlus/models/space/filter.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'item.g.dart';
|
||||
@@ -56,6 +57,7 @@ class SpaceItem {
|
||||
int? iconType;
|
||||
@JsonKey(name: 'publish_time_text')
|
||||
String? publishTimeText;
|
||||
List<SpaceTabFilter>? filter;
|
||||
|
||||
SpaceItem({
|
||||
this.title,
|
||||
@@ -92,6 +94,7 @@ class SpaceItem {
|
||||
this.viewContent,
|
||||
this.iconType,
|
||||
this.publishTimeText,
|
||||
this.filter,
|
||||
});
|
||||
|
||||
factory SpaceItem.fromJson(Map<String, dynamic> json) => _$ItemFromJson(json);
|
||||
|
||||
@@ -43,6 +43,9 @@ SpaceItem _$ItemFromJson(Map<String, dynamic> json) => SpaceItem(
|
||||
viewContent: json['view_content'] as String?,
|
||||
iconType: (json['icon_type'] as num?)?.toInt(),
|
||||
publishTimeText: json['publish_time_text'] as String?,
|
||||
filter: (json['filter'] as List?)
|
||||
?.map((e) => SpaceTabFilter.fromJson(e))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ItemToJson(SpaceItem instance) => <String, dynamic>{
|
||||
|
||||
Reference in New Issue
Block a user