mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: new pgc rank
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -65,6 +65,7 @@ class StatView extends _StatItemBase {
|
|||||||
'picture' => Icons.remove_red_eye_outlined,
|
'picture' => Icons.remove_red_eye_outlined,
|
||||||
'like' => Icons.thumb_up_outlined,
|
'like' => Icons.thumb_up_outlined,
|
||||||
'reply' => Icons.comment_outlined,
|
'reply' => Icons.comment_outlined,
|
||||||
|
'follow' => Icons.favorite_border,
|
||||||
_ => Icons.play_circle_outlined,
|
_ => Icons.play_circle_outlined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -691,6 +691,10 @@ class Api {
|
|||||||
/// 排行榜
|
/// 排行榜
|
||||||
static const String getRankApi = "/x/web-interface/ranking/v2";
|
static const String getRankApi = "/x/web-interface/ranking/v2";
|
||||||
|
|
||||||
|
static const String pgcRank = "/pgc/web/rank/list";
|
||||||
|
|
||||||
|
static const String pgcSeasonRank = "/pgc/season/rank/web/list";
|
||||||
|
|
||||||
/// 取消订阅-合集
|
/// 取消订阅-合集
|
||||||
static const String unfavSeason = '/x/v3/fav/season/unfav';
|
static const String unfavSeason = '/x/v3/fav/season/unfav';
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:developer';
|
|||||||
import 'package:PiliPlus/grpc/app/card/v1/card.pb.dart' as card;
|
import 'package:PiliPlus/grpc/app/card/v1/card.pb.dart' as card;
|
||||||
import 'package:PiliPlus/grpc/grpc_repo.dart';
|
import 'package:PiliPlus/grpc/grpc_repo.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
|
import 'package:PiliPlus/models/bangumi/pgc_rank/pgc_rank_item_model.dart';
|
||||||
import 'package:PiliPlus/models/member/article.dart';
|
import 'package:PiliPlus/models/member/article.dart';
|
||||||
import 'package:PiliPlus/utils/extension.dart';
|
import 'package:PiliPlus/utils/extension.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
@@ -966,8 +967,13 @@ class VideoHttp {
|
|||||||
// 视频排行
|
// 视频排行
|
||||||
static Future<LoadingState<List<HotVideoItemModel>>> getRankVideoList(
|
static Future<LoadingState<List<HotVideoItemModel>>> getRankVideoList(
|
||||||
int rid) async {
|
int rid) async {
|
||||||
var rankApi = "${Api.getRankApi}?rid=$rid&type=all";
|
var res = await Request().get(
|
||||||
var res = await Request().get(rankApi);
|
Api.getRankApi,
|
||||||
|
queryParameters: await WbiSign.makSign({
|
||||||
|
'rid': rid,
|
||||||
|
'type': 'all',
|
||||||
|
}),
|
||||||
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
List<HotVideoItemModel> list = <HotVideoItemModel>[];
|
List<HotVideoItemModel> list = <HotVideoItemModel>[];
|
||||||
Set<int> blackMids = GStorage.blackMids;
|
Set<int> blackMids = GStorage.blackMids;
|
||||||
@@ -990,6 +996,44 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pgc 排行
|
||||||
|
static Future<LoadingState> pgcRankList(
|
||||||
|
{int day = 3, required int seasonType}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.pgcRank,
|
||||||
|
queryParameters: await WbiSign.makSign({
|
||||||
|
'day': day,
|
||||||
|
'season_type': seasonType,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return LoadingState.success((res.data['result']?['list'] as List?)
|
||||||
|
?.map((e) => PgcRankItemModel.fromJson(e))
|
||||||
|
.toList());
|
||||||
|
} else {
|
||||||
|
return LoadingState.error(res.data['message']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// pgc season 排行
|
||||||
|
static Future<LoadingState> pgcSeasonRankList(
|
||||||
|
{int day = 3, required int seasonType}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.pgcSeasonRank,
|
||||||
|
queryParameters: await WbiSign.makSign({
|
||||||
|
'day': day,
|
||||||
|
'season_type': seasonType,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return LoadingState.success((res.data['data']?['list'] as List?)
|
||||||
|
?.map((e) => PgcRankItemModel.fromJson(e))
|
||||||
|
.toList());
|
||||||
|
} else {
|
||||||
|
return LoadingState.error(res.data['message']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Future<LoadingState> getVideoNoteList({
|
static Future<LoadingState> getVideoNoteList({
|
||||||
dynamic oid,
|
dynamic oid,
|
||||||
dynamic uperMid,
|
dynamic uperMid,
|
||||||
|
|||||||
19
lib/models/bangumi/pgc_rank/badge_info.dart
Normal file
19
lib/models/bangumi/pgc_rank/badge_info.dart
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
||||||
23
lib/models/bangumi/pgc_rank/data.dart
Normal file
23
lib/models/bangumi/pgc_rank/data.dart
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
||||||
16
lib/models/bangumi/pgc_rank/icon_font.dart
Normal file
16
lib/models/bangumi/pgc_rank/icon_font.dart
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
||||||
16
lib/models/bangumi/pgc_rank/new_ep.dart
Normal file
16
lib/models/bangumi/pgc_rank/new_ep.dart
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
||||||
85
lib/models/bangumi/pgc_rank/pgc_rank_item_model.dart
Normal file
85
lib/models/bangumi/pgc_rank/pgc_rank_item_model.dart
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
||||||
22
lib/models/bangumi/pgc_rank/stat.dart
Normal file
22
lib/models/bangumi/pgc_rank/stat.dart
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
enum RandType {
|
enum RandType {
|
||||||
all,
|
all,
|
||||||
|
bangumi,
|
||||||
creation,
|
creation,
|
||||||
animation,
|
animation,
|
||||||
music,
|
music,
|
||||||
@@ -20,12 +19,14 @@ enum RandType {
|
|||||||
film,
|
film,
|
||||||
documentary,
|
documentary,
|
||||||
movie,
|
movie,
|
||||||
teleplay
|
teleplay,
|
||||||
|
show,
|
||||||
}
|
}
|
||||||
|
|
||||||
extension RankTypeDesc on RandType {
|
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];
|
][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
List tabsConfig = [
|
const List tabsConfig = [
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 0,
|
'rid': 0,
|
||||||
'label': '全站',
|
'label': '全站',
|
||||||
'type': RandType.all,
|
'type': RandType.all,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
'season_type': 1,
|
||||||
Icons.live_tv_outlined,
|
'label': '番剧',
|
||||||
size: 15,
|
'type': RandType.bangumi,
|
||||||
),
|
},
|
||||||
'rid': 168,
|
{
|
||||||
|
// 'rid': 168,
|
||||||
|
'season_type': 4,
|
||||||
'label': '国创',
|
'label': '国创',
|
||||||
'type': RandType.creation,
|
'type': RandType.creation,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1005, //1,
|
'rid': 1005, //1,
|
||||||
'label': '动画',
|
'label': '动画',
|
||||||
'type': RandType.animation,
|
'type': RandType.animation,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1003, // 3,
|
'rid': 1003, // 3,
|
||||||
'label': '音乐',
|
'label': '音乐',
|
||||||
'type': RandType.music,
|
'type': RandType.music,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1004, // 129,
|
'rid': 1004, // 129,
|
||||||
'label': '舞蹈',
|
'label': '舞蹈',
|
||||||
'type': RandType.dance,
|
'type': RandType.dance,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1008, // 4,
|
'rid': 1008, // 4,
|
||||||
'label': '游戏',
|
'label': '游戏',
|
||||||
'type': RandType.game,
|
'type': RandType.game,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1010, // 36,
|
'rid': 1010, // 36,
|
||||||
'label': '知识',
|
'label': '知识',
|
||||||
'type': RandType.knowledge,
|
'type': RandType.knowledge,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1012, // 188,
|
'rid': 1012, // 188,
|
||||||
'label': '科技',
|
'label': '科技',
|
||||||
'type': RandType.technology,
|
'type': RandType.technology,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1018, //234,
|
'rid': 1018, //234,
|
||||||
'label': '运动',
|
'label': '运动',
|
||||||
'type': RandType.sport,
|
'type': RandType.sport,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1013, // 223,
|
'rid': 1013, // 223,
|
||||||
'label': '汽车',
|
'label': '汽车',
|
||||||
'type': RandType.car,
|
'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,
|
'rid': 1020, // 211,
|
||||||
'label': '美食',
|
'label': '美食',
|
||||||
'type': RandType.food,
|
'type': RandType.food,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1024, //217,
|
'rid': 1024, //217,
|
||||||
'label': '动物',
|
'label': '动物',
|
||||||
'type': RandType.animal,
|
'type': RandType.animal,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1007, // 119,
|
'rid': 1007, // 119,
|
||||||
'label': '鬼畜',
|
'label': '鬼畜',
|
||||||
'type': RandType.madness,
|
'type': RandType.madness,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1014, // 155,
|
'rid': 1014, // 155,
|
||||||
'label': '时尚',
|
'label': '时尚',
|
||||||
'type': RandType.fashion,
|
'type': RandType.fashion,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1002, // 5,
|
'rid': 1002, // 5,
|
||||||
'label': '娱乐',
|
'label': '娱乐',
|
||||||
'type': RandType.entertainment,
|
'type': RandType.entertainment,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
|
||||||
Icons.live_tv_outlined,
|
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 1001, // 181,
|
'rid': 1001, // 181,
|
||||||
'label': '影视',
|
'label': '影视',
|
||||||
'type': RandType.film,
|
'type': RandType.film,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
// 'rid': 177,
|
||||||
Icons.live_tv_outlined,
|
'season_type': 3,
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 177,
|
|
||||||
'label': '纪录',
|
'label': '纪录',
|
||||||
'type': RandType.documentary,
|
'type': RandType.documentary,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
// 'rid': 23,
|
||||||
Icons.live_tv_outlined,
|
'season_type': 2,
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 23,
|
|
||||||
'label': '电影',
|
'label': '电影',
|
||||||
'type': RandType.movie,
|
'type': RandType.movie,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'icon': const Icon(
|
// 'rid': 11,
|
||||||
Icons.live_tv_outlined,
|
'season_type': 5,
|
||||||
size: 15,
|
|
||||||
),
|
|
||||||
'rid': 11,
|
|
||||||
'label': '剧集',
|
'label': '剧集',
|
||||||
'type': RandType.teleplay,
|
'type': RandType.teleplay,
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
// 'rid': 11,
|
||||||
|
'season_type': 7,
|
||||||
|
'label': '综艺',
|
||||||
|
'type': RandType.show,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -89,8 +89,12 @@ class _RankPageState extends State<RankPage>
|
|||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
controller: _rankController.tabController,
|
controller: _rankController.tabController,
|
||||||
children:
|
children: tabsConfig
|
||||||
tabsConfig.map((item) => ZonePage(rid: item['rid'])).toList(),
|
.map((item) => ZonePage(
|
||||||
|
rid: item['rid'],
|
||||||
|
seasonType: item['season_type'],
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/video.dart';
|
import 'package:PiliPlus/http/video.dart';
|
||||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
|
||||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||||
|
|
||||||
class ZoneController
|
class ZoneController extends CommonListController {
|
||||||
extends CommonListController<List<HotVideoItemModel>, HotVideoItemModel> {
|
ZoneController({this.rid, this.seasonType});
|
||||||
ZoneController({required this.zoneID});
|
|
||||||
int zoneID;
|
int? rid;
|
||||||
|
int? seasonType;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -15,6 +15,13 @@ class ZoneController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<LoadingState<List<HotVideoItemModel>>> customGetData() =>
|
Future<LoadingState> customGetData() {
|
||||||
VideoHttp.getRankVideoList(zoneID);
|
if (rid != null) {
|
||||||
|
return VideoHttp.getRankVideoList(rid!);
|
||||||
|
}
|
||||||
|
if (seasonType == 1) {
|
||||||
|
return VideoHttp.pgcRankList(seasonType: seasonType!);
|
||||||
|
}
|
||||||
|
return VideoHttp.pgcSeasonRankList(seasonType: seasonType!);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
|||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||||
import 'package:PiliPlus/pages/common/common_page.dart';
|
import 'package:PiliPlus/pages/common/common_page.dart';
|
||||||
|
import 'package:PiliPlus/pages/rank/zone/widget/pgc_rank_item.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
@@ -13,9 +14,10 @@ import 'package:PiliPlus/pages/rank/zone/index.dart';
|
|||||||
import '../../../utils/grid.dart';
|
import '../../../utils/grid.dart';
|
||||||
|
|
||||||
class ZonePage extends CommonPage {
|
class ZonePage extends CommonPage {
|
||||||
const ZonePage({super.key, required this.rid});
|
const ZonePage({super.key, this.rid, this.seasonType});
|
||||||
|
|
||||||
final int rid;
|
final int? rid;
|
||||||
|
final int? seasonType;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ZonePage> createState() => _ZonePageState();
|
State<ZonePage> createState() => _ZonePageState();
|
||||||
@@ -25,8 +27,8 @@ class _ZonePageState extends CommonPageState<ZonePage, ZoneController>
|
|||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
@override
|
@override
|
||||||
late ZoneController controller = Get.put(
|
late ZoneController controller = Get.put(
|
||||||
ZoneController(zoneID: widget.rid),
|
ZoneController(rid: widget.rid, seasonType: widget.seasonType),
|
||||||
tag: widget.rid.toString(),
|
tag: '${widget.rid}${widget.seasonType}',
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -66,7 +68,7 @@ class _ZonePageState extends CommonPageState<ZonePage, ZoneController>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody(LoadingState<List<HotVideoItemModel>?> loadingState) {
|
Widget _buildBody(LoadingState<List<dynamic>?> loadingState) {
|
||||||
return switch (loadingState) {
|
return switch (loadingState) {
|
||||||
Loading() => _buildSkeleton(),
|
Loading() => _buildSkeleton(),
|
||||||
Success() => loadingState.response?.isNotEmpty == true
|
Success() => loadingState.response?.isNotEmpty == true
|
||||||
@@ -74,10 +76,14 @@ class _ZonePageState extends CommonPageState<ZonePage, ZoneController>
|
|||||||
gridDelegate: Grid.videoCardHDelegate(context),
|
gridDelegate: Grid.videoCardHDelegate(context),
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
(context, index) {
|
(context, index) {
|
||||||
return VideoCardH(
|
final item = loadingState.response![index];
|
||||||
videoItem: loadingState.response![index],
|
if (item is HotVideoItemModel) {
|
||||||
showPubdate: true,
|
return VideoCardH(
|
||||||
);
|
videoItem: item,
|
||||||
|
showPubdate: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return PgcRankItem(item: item);
|
||||||
},
|
},
|
||||||
childCount: loadingState.response!.length,
|
childCount: loadingState.response!.length,
|
||||||
),
|
),
|
||||||
|
|||||||
98
lib/pages/rank/zone/widget/pgc_rank_item.dart
Normal file
98
lib/pages/rank/zone/widget/pgc_rank_item.dart
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||||
|
import 'package:PiliPlus/models/bangumi/pgc_rank/pgc_rank_item_model.dart';
|
||||||
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class PgcRankItem extends StatelessWidget {
|
||||||
|
const PgcRankItem({super.key, required this.item});
|
||||||
|
|
||||||
|
final PgcRankItemModel item;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (item.url != null) {
|
||||||
|
PiliScheme.routePushFromUrl(item.url!);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLongPress: () {
|
||||||
|
imageSaveDialog(
|
||||||
|
context: context,
|
||||||
|
title: item.title,
|
||||||
|
cover: item.cover,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: StyleString.safeSpace,
|
||||||
|
vertical: 5,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AspectRatio(
|
||||||
|
aspectRatio: 3 / 4,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) {
|
||||||
|
return NetworkImgLayer(
|
||||||
|
radius: 6,
|
||||||
|
width: constraints.maxWidth,
|
||||||
|
height: constraints.maxHeight,
|
||||||
|
src: item.cover,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(item.title!),
|
||||||
|
),
|
||||||
|
if (item.newEp?.indexShow?.isNotEmpty == true) ...[
|
||||||
|
Text(
|
||||||
|
item.newEp!.indexShow!,
|
||||||
|
maxLines: 1,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
overflow: TextOverflow.clip,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
],
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
StatView(
|
||||||
|
context: context,
|
||||||
|
theme: 'gray',
|
||||||
|
value: item.stat!.view!,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
StatView(
|
||||||
|
context: context,
|
||||||
|
theme: 'gray',
|
||||||
|
goto: 'follow',
|
||||||
|
value: item.stat!.follow!,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user