feat: new pgc rank

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-25 19:44:11 +08:00
parent f10aa38bfd
commit 1e851d34b6
14 changed files with 393 additions and 140 deletions

View File

@@ -0,0 +1,19 @@
class BadgeInfo {
String? bgColor;
String? bgColorNight;
String? text;
BadgeInfo({this.bgColor, this.bgColorNight, this.text});
factory BadgeInfo.fromJson(Map<String, dynamic> json) => BadgeInfo(
bgColor: json['bg_color'] as String?,
bgColorNight: json['bg_color_night'] as String?,
text: json['text'] as String?,
);
Map<String, dynamic> toJson() => {
'bg_color': bgColor,
'bg_color_night': bgColorNight,
'text': text,
};
}

View File

@@ -0,0 +1,23 @@
import 'pgc_rank_item_model.dart';
class Data {
List<PgcRankItemModel>? list;
String? note;
int? seasonType;
Data({this.list, this.note, this.seasonType});
factory Data.fromJson(Map<String, dynamic> json) => Data(
list: (json['list'] as List<dynamic>?)
?.map((e) => PgcRankItemModel.fromJson(e as Map<String, dynamic>))
.toList(),
note: json['note'] as String?,
seasonType: json['season_type'] as int?,
);
Map<String, dynamic> toJson() => {
'list': list?.map((e) => e.toJson()).toList(),
'note': note,
'season_type': seasonType,
};
}

View File

@@ -0,0 +1,16 @@
class IconFont {
String? name;
String? text;
IconFont({this.name, this.text});
factory IconFont.fromJson(Map<String, dynamic> json) => IconFont(
name: json['name'] as String?,
text: json['text'] as String?,
);
Map<String, dynamic> toJson() => {
'name': name,
'text': text,
};
}

View File

@@ -0,0 +1,16 @@
class NewEp {
String? cover;
String? indexShow;
NewEp({this.cover, this.indexShow});
factory NewEp.fromJson(Map<String, dynamic> json) => NewEp(
cover: json['cover'] as String?,
indexShow: json['index_show'] as String?,
);
Map<String, dynamic> toJson() => {
'cover': cover,
'index_show': indexShow,
};
}

View File

@@ -0,0 +1,85 @@
import 'badge_info.dart';
import 'icon_font.dart';
import 'new_ep.dart';
import 'stat.dart';
class PgcRankItemModel {
String? badge;
BadgeInfo? badgeInfo;
int? badgeType;
String? cover;
String? desc;
bool? enableVt;
IconFont? iconFont;
NewEp? newEp;
int? rank;
String? rating;
int? seasonId;
String? ssHorizontalCover;
Stat? stat;
String? title;
String? url;
PgcRankItemModel({
this.badge,
this.badgeInfo,
this.badgeType,
this.cover,
this.desc,
this.enableVt,
this.iconFont,
this.newEp,
this.rank,
this.rating,
this.seasonId,
this.ssHorizontalCover,
this.stat,
this.title,
this.url,
});
factory PgcRankItemModel.fromJson(Map<String, dynamic> json) =>
PgcRankItemModel(
badge: json['badge'] as String?,
badgeInfo: json['badge_info'] == null
? null
: BadgeInfo.fromJson(json['badge_info'] as Map<String, dynamic>),
badgeType: json['badge_type'] as int?,
cover: json['cover'] as String?,
desc: json['desc'] as String?,
enableVt: json['enable_vt'] as bool?,
iconFont: json['icon_font'] == null
? null
: IconFont.fromJson(json['icon_font'] as Map<String, dynamic>),
newEp: json['new_ep'] == null
? null
: NewEp.fromJson(json['new_ep'] as Map<String, dynamic>),
rank: json['rank'] as int?,
rating: json['rating'] as String?,
seasonId: json['season_id'] as int?,
ssHorizontalCover: json['ss_horizontal_cover'] as String?,
stat: json['stat'] == null
? null
: Stat.fromJson(json['stat'] as Map<String, dynamic>),
title: json['title'] as String?,
url: json['url'] as String?,
);
Map<String, dynamic> toJson() => {
'badge': badge,
'badge_info': badgeInfo?.toJson(),
'badge_type': badgeType,
'cover': cover,
'desc': desc,
'enable_vt': enableVt,
'icon_font': iconFont?.toJson(),
'new_ep': newEp?.toJson(),
'rank': rank,
'rating': rating,
'season_id': seasonId,
'ss_horizontal_cover': ssHorizontalCover,
'stat': stat?.toJson(),
'title': title,
'url': url,
};
}

View File

@@ -0,0 +1,22 @@
class Stat {
int? danmaku;
int? follow;
int? seriesFollow;
int? view;
Stat({this.danmaku, this.follow, this.seriesFollow, this.view});
factory Stat.fromJson(Map<String, dynamic> json) => Stat(
danmaku: json['danmaku'] as int?,
follow: (json['follow'] as int?) ?? 0,
seriesFollow: json['series_follow'] as int?,
view: (json['view'] as int?) ?? 0,
);
Map<String, dynamic> toJson() => {
'danmaku': danmaku,
'follow': follow,
'series_follow': seriesFollow,
'view': view,
};
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
enum RandType {
all,
bangumi,
creation,
animation,
music,
@@ -20,12 +19,14 @@ enum RandType {
film,
documentary,
movie,
teleplay
teleplay,
show,
}
extension RankTypeDesc on RandType {
String get description => [
String get description => const [
'全站',
'番剧',
'国创',
'动画',
'音乐',
@@ -35,7 +36,6 @@ extension RankTypeDesc on RandType {
'科技',
'运动',
'汽车',
'生活',
'美食',
'动物',
'鬼畜',
@@ -44,212 +44,120 @@ extension RankTypeDesc on RandType {
'影视',
'纪录',
'电影',
'剧集'
][index];
String get id => [
'all',
'creation',
'animation',
'music',
'dance',
'game',
'knowledge',
'technology',
'sport',
'car',
'life',
'food',
'animal',
'madness',
'fashion',
'entertainment',
'film',
'documentary',
'movie',
'teleplay'
'剧集',
'综艺',
][index];
}
List tabsConfig = [
const List tabsConfig = [
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 0,
'label': '全站',
'type': RandType.all,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 168,
'season_type': 1,
'label': '番剧',
'type': RandType.bangumi,
},
{
// 'rid': 168,
'season_type': 4,
'label': '国创',
'type': RandType.creation,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1005, //1,
'label': '动画',
'type': RandType.animation,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1003, // 3,
'label': '音乐',
'type': RandType.music,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1004, // 129,
'label': '舞蹈',
'type': RandType.dance,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1008, // 4,
'label': '游戏',
'type': RandType.game,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1010, // 36,
'label': '知识',
'type': RandType.knowledge,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1012, // 188,
'label': '科技',
'type': RandType.technology,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1018, //234,
'label': '运动',
'type': RandType.sport,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1013, // 223,
'label': '汽车',
'type': RandType.car,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 160,
'label': '生活',
'type': RandType.life,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1020, // 211,
'label': '美食',
'type': RandType.food,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1024, //217,
'label': '动物',
'type': RandType.animal,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1007, // 119,
'label': '鬼畜',
'type': RandType.madness,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1014, // 155,
'label': '时尚',
'type': RandType.fashion,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1002, // 5,
'label': '娱乐',
'type': RandType.entertainment,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 1001, // 181,
'label': '影视',
'type': RandType.film,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 177,
// 'rid': 177,
'season_type': 3,
'label': '纪录',
'type': RandType.documentary,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 23,
// 'rid': 23,
'season_type': 2,
'label': '电影',
'type': RandType.movie,
},
{
'icon': const Icon(
Icons.live_tv_outlined,
size: 15,
),
'rid': 11,
// 'rid': 11,
'season_type': 5,
'label': '剧集',
'type': RandType.teleplay,
}
},
{
// 'rid': 11,
'season_type': 7,
'label': '综艺',
'type': RandType.show,
},
];