refa: vertical video page (#328)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-02-26 17:21:24 +08:00
committed by GitHub
parent 41f251ad50
commit 8434c488da
30 changed files with 2534 additions and 224 deletions

View File

@@ -134,8 +134,8 @@ class PiliScheme {
if (aid != null || bvid != null) {
if (queryParameters['cid'] != null) {
bvid ??= IdUtils.av2bv(int.parse(aid!));
Utils.toDupNamed(
'/video?bvid=$bvid&cid=${queryParameters['cid']}',
Utils.toViewPage(
'bvid=$bvid&cid=${queryParameters['cid']}',
arguments: {
'pic': null,
'heroTag': Utils.makeHeroTag(aid),
@@ -143,6 +143,7 @@ class PiliScheme {
'progress': int.tryParse(queryParameters['dm_progress']!),
},
off: off,
preventDuplicates: false,
);
} else {
videoPush(
@@ -566,14 +567,15 @@ class PiliScheme {
if (showDialog) {
SmartDialog.dismiss();
}
Utils.toDupNamed(
'/video?bvid=$bvid&cid=$cid',
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: {
'pic': null,
'heroTag': Utils.makeHeroTag(aid),
if (progress != null) 'progress': int.tryParse(progress),
},
off: off,
preventDuplicates: false,
);
} catch (e) {
SmartDialog.dismiss();

View File

@@ -388,6 +388,9 @@ class GStorage {
static bool get expandDynLivePanel => GStorage.setting
.get(SettingBoxKey.expandDynLivePanel, defaultValue: false);
static bool collapsibleVideoPage = GStorage.setting
.get(SettingBoxKey.collapsibleVideoPage, defaultValue: true);
static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -640,6 +643,7 @@ class SettingBoxKey {
antiGoodsReply = 'antiGoodsReply',
expandDynLivePanel = 'expandDynLivePanel',
springDescription = 'springDescription',
collapsibleVideoPage = 'collapsibleVideoPage',
// Sponsor Block
enableSponsorBlock = 'enableSponsorBlock',

View File

@@ -1,7 +1,6 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import '../http/init.dart';
import '../http/search.dart';
@@ -66,8 +65,8 @@ class UrlUtils {
String? bvid = matchRes['BV'];
bvid ??= IdUtils.av2bv(aid!);
final int cid = await SearchHttp.ab2c(aid: aid, bvid: bvid);
await Get.toNamed(
'/video?bvid=$bvid&cid=$cid',
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: <String, String?>{
'pic': '',
'heroTag': Utils.makeHeroTag(bvid),

View File

@@ -48,6 +48,33 @@ class Utils {
static const channel = MethodChannel("PiliPlus");
static void toViewPage(
String page, {
dynamic arguments,
int? id,
bool preventDuplicates = true,
Map<String, String>? parameters,
bool off = false,
}) {
if (off) {
Get.offNamed(
'${GStorage.collapsibleVideoPage ? '/videoV' : '/video'}?$page',
arguments: arguments,
id: id,
preventDuplicates: preventDuplicates,
parameters: parameters,
);
} else {
Get.toNamed(
'${GStorage.collapsibleVideoPage ? '/videoV' : '/video'}?$page',
arguments: arguments,
id: id,
preventDuplicates: preventDuplicates,
parameters: parameters,
);
}
}
static Future insertCreatedDyn(result) async {
try {
dynamic id = result['data']['dyn_id'];
@@ -384,12 +411,13 @@ class Utils {
String bvid = item.modules.moduleDynamic.major.archive.bvid;
String cover = item.modules.moduleDynamic.major.archive.cover;
int cid = await SearchHttp.ab2c(bvid: bvid);
Utils.toDupNamed(
'/video?bvid=$bvid&cid=$cid',
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: {
'pic': cover,
'heroTag': Utils.makeHeroTag(bvid),
},
preventDuplicates: false,
);
} catch (err) {
SmartDialog.showToast(err.toString());
@@ -454,12 +482,13 @@ class Utils {
String bvid = IdUtils.av2bv(aid);
String cover = ugcSeason.cover!;
int cid = await SearchHttp.ab2c(bvid: bvid);
Utils.toDupNamed(
'/video?bvid=$bvid&cid=$cid',
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: {
'pic': cover,
'heroTag': Utils.makeHeroTag(bvid),
},
preventDuplicates: false,
);
break;
@@ -845,14 +874,15 @@ class Utils {
for (EpisodeItem item in item.episodes!) {
if (item.epId.toString() == epId.toString()) {
// view as normal video
Utils.toDupNamed(
'/video?bvid=${item.bvid}&cid=${item.cid}&seasonId=${data.seasonId}&epId=${item.epId}',
Utils.toViewPage(
'bvid=${item.bvid}&cid=${item.cid}&seasonId=${data.seasonId}&epId=${item.epId}',
arguments: {
'pgcApi': true,
'pic': item.cover,
'heroTag': Utils.makeHeroTag(item.cid),
'videoType': SearchType.video,
},
preventDuplicates: false,
);
return;
}
@@ -873,14 +903,15 @@ class Utils {
) ??
data.episodes!.first
: data.episodes!.first;
Utils.toDupNamed(
'/video?bvid=${episode.bvid}&cid=${episode.cid}&seasonId=${data.seasonId}&epId=${episode.epId}&type=${data.type}',
Utils.toViewPage(
'bvid=${episode.bvid}&cid=${episode.cid}&seasonId=${data.seasonId}&epId=${episode.epId}&type=${data.type}',
arguments: {
'pic': episode.cover,
'heroTag': Utils.makeHeroTag(episode.cid),
'videoType': SearchType.media_bangumi,
'bangumiItem': data,
},
preventDuplicates: false,
);
} else {
SmartDialog.showToast(result['msg']);