mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 10:06:23 +08:00
feat: live area page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
48
lib/models/live/live_area_list/area_item.dart
Normal file
48
lib/models/live/live_area_list/area_item.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
class AreaItem {
|
||||
dynamic id;
|
||||
String? name;
|
||||
String? link;
|
||||
String? pic;
|
||||
dynamic parentId;
|
||||
String? parentName;
|
||||
int? areaType;
|
||||
int? tagType;
|
||||
|
||||
bool? isFav;
|
||||
|
||||
AreaItem({
|
||||
this.id,
|
||||
this.name,
|
||||
this.link,
|
||||
this.pic,
|
||||
this.parentId,
|
||||
this.parentName,
|
||||
this.areaType,
|
||||
this.tagType,
|
||||
});
|
||||
|
||||
factory AreaItem.fromJson(Map<String, dynamic> json) => AreaItem(
|
||||
id: json['id'],
|
||||
name: json['name'] as String?,
|
||||
link: json['link'] as String?,
|
||||
pic: json['pic'] as String?,
|
||||
parentId: json['parent_id'],
|
||||
parentName: json['parent_name'] as String?,
|
||||
areaType: json['area_type'] as int?,
|
||||
tagType: json['tag_type'] as int?,
|
||||
);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) {
|
||||
return true;
|
||||
}
|
||||
if (other is AreaItem) {
|
||||
return id == other.id && parentId == other.parentId;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(id, parentId);
|
||||
}
|
||||
19
lib/models/live/live_area_list/area_list.dart
Normal file
19
lib/models/live/live_area_list/area_list.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'area_item.dart';
|
||||
|
||||
class AreaList {
|
||||
int? id;
|
||||
String? name;
|
||||
int? parentAreaType;
|
||||
List<AreaItem>? areaList;
|
||||
|
||||
AreaList({this.id, this.name, this.parentAreaType, this.areaList});
|
||||
|
||||
factory AreaList.fromJson(Map<String, dynamic> json) => AreaList(
|
||||
id: json['id'] as int?,
|
||||
name: json['name'] ?? '',
|
||||
parentAreaType: json['parent_area_type'] as int?,
|
||||
areaList: (json['area_list'] as List<dynamic>?)
|
||||
?.map((e) => AreaItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
import 'package:PiliPlus/models/live/live_feed_index/card_data_list_item.dart';
|
||||
import 'package:PiliPlus/models/live/live_second_list/tag.dart';
|
||||
|
||||
class LiveSecondData {
|
||||
int? count;
|
||||
List<CardLiveItem>? cardList;
|
||||
List<LiveSecondTag>? newTags;
|
||||
|
||||
LiveSecondData({
|
||||
this.count,
|
||||
this.cardList,
|
||||
this.newTags,
|
||||
});
|
||||
|
||||
factory LiveSecondData.fromJson(Map<String, dynamic> json) => LiveSecondData(
|
||||
@@ -14,10 +17,8 @@ class LiveSecondData {
|
||||
cardList: (json['list'] as List<dynamic>?)
|
||||
?.map((e) => CardLiveItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
newTags: (json['new_tags'] as List<dynamic>?)
|
||||
?.map((e) => LiveSecondTag.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'count': count,
|
||||
'list': cardList?.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
|
||||
17
lib/models/live/live_second_list/tag.dart
Normal file
17
lib/models/live/live_second_list/tag.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
class LiveSecondTag {
|
||||
int? id;
|
||||
String? name;
|
||||
String? sortType;
|
||||
|
||||
LiveSecondTag({
|
||||
this.id,
|
||||
this.name,
|
||||
this.sortType,
|
||||
});
|
||||
|
||||
factory LiveSecondTag.fromJson(Map json) => LiveSecondTag(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
sortType: json['sort_type'],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user