feat: pugv (#927)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-08-03 15:25:29 +08:00
committed by GitHub
parent cf835e330b
commit bd3d6cf34c
33 changed files with 596 additions and 421 deletions

View File

@@ -7,6 +7,7 @@ import 'package:PiliPlus/grpc/view.dart';
import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/search.dart';
import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/models/common/video/video_type.dart';
import 'package:PiliPlus/models/pgc_lcf.dart';
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
@@ -43,20 +44,23 @@ class PgcIntroController extends CommonIntroController {
? '追番'
: '追剧';
final isPgc = Get.arguments['videoType'] == VideoType.pgc;
final PgcInfoModel pgcItem = Get.arguments['pgcItem'];
@override
void onInit() {
super.onInit();
if (accountService.isLogin.value) {
if (seasonId != null) {
queryIsFollowed();
}
if (epId != null) {
queryPgcLikeCoinFav();
if (isPgc) {
if (accountService.isLogin.value) {
if (seasonId != null) {
queryIsFollowed();
}
if (epId != null) {
queryPgcLikeCoinFav();
}
}
queryVideoTags();
}
queryVideoTags();
}
// 获取点赞/投币/收藏状态
@@ -226,7 +230,9 @@ class PgcIntroController extends CommonIntroController {
EpisodeItem item = pgcItem.episodes!.firstWhere(
(item) => item.epId == epId,
);
final title = '${item.title!} ${item.showTitle}';
final title =
item.shareCopy ??
'${pgcItem.title} ${item.showTitle ?? item.longTitle}';
PageUtils.pmShare(
context,
content: {
@@ -263,7 +269,7 @@ class PgcIntroController extends CommonIntroController {
// 修改分P或番剧分集
Future<void> onChangeEpisode(BaseEpisodeItem episode) async {
try {
final int epId = episode.epId!;
final int epId = episode.epId ?? episode.id!;
final String bvid = episode.bvid ?? this.bvid;
final int aid = episode.aid ?? IdUtils.bv2av(bvid);
final int? cid =
@@ -284,6 +290,7 @@ class PgcIntroController extends CommonIntroController {
..onReset()
..epId = epId
..bvid = bvid
..aid = aid
..cid.value = cid
..queryVideoUrl();
if (cover != null && cover.isNotEmpty) {
@@ -299,7 +306,7 @@ class PgcIntroController extends CommonIntroController {
} catch (_) {}
}
if (accountService.isLogin.value) {
if (isPgc && accountService.isLogin.value) {
queryPgcLikeCoinFav();
}

View File

@@ -122,130 +122,158 @@ class _PgcIntroPageState extends State<PgcIntroPage>
],
),
Expanded(
child: GestureDetector(
onTap: () => widget.showIntroDetail(
item,
pgcIntroController.videoTags.value,
),
behavior: HitTestBehavior.opaque,
child: SizedBox(
height: isLandscape ? 115 : 115 / 0.75,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 20,
children: [
Expanded(
child: Text(
item.title!,
style: const TextStyle(
fontSize: 16,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
child: !pgcIntroController.isPgc
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title!,
style: const TextStyle(fontSize: 16),
),
const SizedBox(height: 5),
if (item.subtitle?.isNotEmpty == true)
Text(
item.subtitle!,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.onSurfaceVariant,
),
),
Obx(
() {
final isFollowed =
pgcIntroController.isFollowed.value;
final followStatus =
pgcIntroController.followStatus.value;
return FilledButton.tonal(
style: FilledButton.styleFrom(
tapTargetSize:
MaterialTapTargetSize.shrinkWrap,
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
],
)
: GestureDetector(
onTap: () => widget.showIntroDetail(
item,
pgcIntroController.videoTags.value,
),
behavior: HitTestBehavior.opaque,
child: SizedBox(
height: isLandscape ? 115 : 115 / 0.75,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 20,
children: [
Expanded(
child: Text(
item.title!,
style: const TextStyle(
fontSize: 16,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
visualDensity: VisualDensity.compact,
foregroundColor: isFollowed
? theme.colorScheme.outline
: null,
backgroundColor: isFollowed
? theme.colorScheme.onInverseSurface
: null,
),
onPressed: followStatus == -1
? null
: () {
if (isFollowed) {
showPgcFollowDialog(
context: context,
type:
pgcIntroController.pgcType,
followStatus: followStatus,
onUpdateStatus: (followStatus) {
if (followStatus == -1) {
pgcIntroController.pgcDel();
} else {
pgcIntroController
.pgcUpdate(
Obx(
() {
final isFollowed =
pgcIntroController.isFollowed.value;
final followStatus = pgcIntroController
.followStatus
.value;
return FilledButton.tonal(
style: FilledButton.styleFrom(
tapTargetSize: MaterialTapTargetSize
.shrinkWrap,
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
visualDensity:
VisualDensity.compact,
foregroundColor: isFollowed
? theme.colorScheme.outline
: null,
backgroundColor: isFollowed
? theme
.colorScheme
.onInverseSurface
: null,
),
onPressed: followStatus == -1
? null
: () {
if (isFollowed) {
showPgcFollowDialog(
context: context,
type: pgcIntroController
.pgcType,
followStatus:
followStatus,
);
onUpdateStatus:
(followStatus) {
if (followStatus ==
-1) {
pgcIntroController
.pgcDel();
} else {
pgcIntroController
.pgcUpdate(
followStatus,
);
}
},
);
} else {
pgcIntroController.pgcAdd();
}
},
);
} else {
pgcIntroController.pgcAdd();
}
},
child: Text(
isFollowed
? '${pgcIntroController.pgcType}'
: pgcIntroController.pgcType,
child: Text(
isFollowed
? '${pgcIntroController.pgcType}'
: pgcIntroController.pgcType,
),
);
},
),
);
},
),
],
),
Row(
spacing: 6,
children: [
StatWidget(
type: StatType.play,
value: item.stat!.view,
),
StatWidget(
type: StatType.danmaku,
value: item.stat!.danmaku,
),
if (isLandscape) ...[
areasAndPubTime(theme, item),
newEpDesc(theme, item),
],
),
Row(
spacing: 6,
children: [
StatWidget(
type: StatType.play,
value: item.stat!.view,
),
StatWidget(
type: StatType.danmaku,
value: item.stat!.danmaku,
),
if (isLandscape) ...[
areasAndPubTime(theme, item),
newEpDesc(theme, item),
],
],
),
SizedBox(height: isLandscape ? 2 : 6),
if (!isLandscape) ...[
areasAndPubTime(theme, item),
newEpDesc(theme, item),
],
const Spacer(),
Text(
'简介:${item.evaluate}',
maxLines: isLandscape ? 2 : 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
),
),
],
],
),
SizedBox(height: isLandscape ? 2 : 6),
if (!isLandscape) ...[
areasAndPubTime(theme, item),
newEpDesc(theme, item),
],
const Spacer(),
Text(
'简介:${item.evaluate!}',
maxLines: isLandscape ? 2 : 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
),
),
],
),
),
),
),
),
],
),
const SizedBox(height: 6),
// 点赞收藏转发 布局样式2
actionGrid(theme, item, pgcIntroController),
if (pgcIntroController.isPgc)
actionGrid(theme, item, pgcIntroController),
// 番剧分p
if (item.episodes!.isNotEmpty) ...[
PgcPanel(

View File

@@ -87,6 +87,8 @@ class _PgcPanelState extends State<PgcPanel> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final currEpisode = widget.pages[currentIndex];
final isPugv = currEpisode.from == 'pugv';
return Column(
children: [
Padding(
@@ -97,7 +99,7 @@ class _PgcPanelState extends State<PgcPanel> {
const Text('合集 '),
Expanded(
child: Text(
' 正在播放:${widget.pages[currentIndex].longTitle}',
' 正在播放:${currEpisode.longTitle ?? currEpisode.title}',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
@@ -116,14 +118,14 @@ class _PgcPanelState extends State<PgcPanel> {
null,
null,
widget.pages,
widget.pages[currentIndex].bvid,
widget.pages[currentIndex].aid,
videoDetailCtr.bvid,
videoDetailCtr.aid,
cid,
),
child: Text(
widget.newEp?.desc?.contains('连载') == true
? '连载中,更新至${Utils.isStringNumeric(widget.newEp!.title!) ? '${widget.newEp!.title}' : '${widget.newEp!.title}'}'
: widget.newEp?.desc ?? '',
: widget.newEp?.desc ?? '查看全部',
style: const TextStyle(fontSize: 13),
),
),
@@ -139,103 +141,108 @@ class _PgcPanelState extends State<PgcPanel> {
itemCount: widget.pages.length,
itemExtent: 150,
itemBuilder: (BuildContext context, int index) {
final item = widget.pages[index];
return Container(
width: 150,
margin: EdgeInsets.only(
right: index == widget.pages.length - 1 ? 0 : 10,
),
child: Material(
color: theme.colorScheme.onInverseSurface,
borderRadius: const BorderRadius.all(Radius.circular(6)),
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(6)),
onTap: () {
if (item.badge == '会员' && vipStatus != 1) {
SmartDialog.showToast('需要大会员');
}
widget.onChangeEpisode(item);
},
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 10,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: [
if (index == currentIndex) ...<Widget>[
Image.asset(
'assets/images/live.png',
color: theme.colorScheme.primary,
height: 12,
semanticLabel: "正在播放:",
),
const SizedBox(width: 6),
],
Expanded(
child: Text(
item.title ?? '${index + 1}',
maxLines:
(item.longTitle != null &&
item.longTitle != '')
? 1
: 2,
style: TextStyle(
fontSize: 13,
color: index == currentIndex
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
),
),
),
const SizedBox(width: 2),
if (item.badge != null) ...[
const Spacer(),
if (item.badge == '会员')
Image.asset(
'assets/images/big-vip.png',
height: 16,
semanticLabel: "大会员",
)
else
Text(
item.badge!,
style: TextStyle(
fontSize: 11,
color: theme.colorScheme.primary,
),
),
],
],
),
if (item.longTitle != null &&
item.longTitle != '') ...[
const SizedBox(height: 3),
Text(
item.longTitle!,
maxLines: 1,
style: TextStyle(
fontSize: 13,
color: index == currentIndex
? theme.colorScheme.primary
: theme.colorScheme.onSurface,
),
overflow: TextOverflow.ellipsis,
),
],
],
),
),
),
),
);
return _buildItem(theme, isPugv, index);
},
),
),
],
);
}
Widget _buildItem(ThemeData theme, bool isPugv, int index) {
final item = widget.pages[index];
final hasLongTitle = item.longTitle?.isNotEmpty == true;
final color = index == currentIndex
? theme.colorScheme.primary
: theme.colorScheme.onSurface;
return Container(
width: 150,
height: 60,
margin: EdgeInsets.only(
right: index == widget.pages.length - 1 ? 0 : 10,
),
child: Material(
color: theme.colorScheme.onInverseSurface,
borderRadius: const BorderRadius.all(Radius.circular(6)),
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(6)),
onTap: () {
if (item.badge == '会员' && vipStatus != 1) {
SmartDialog.showToast('需要大会员');
}
widget.onChangeEpisode(item);
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 10),
child: Column(
spacing: 3,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text.rich(
maxLines: hasLongTitle ? 1 : 2,
TextSpan(
children: [
if (index == currentIndex)
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Padding(
padding: const EdgeInsets.only(right: 6),
child: Image.asset(
'assets/images/live.png',
color: theme.colorScheme.primary,
height: 12,
semanticLabel: "正在播放:",
),
),
),
TextSpan(
text: item.title ?? '${index + 1}',
style: TextStyle(
fontSize: 13,
color: color,
),
),
],
),
),
),
if (item.badge?.isNotEmpty == true) ...[
const SizedBox(width: 2),
if (item.badge == '会员')
Image.asset(
'assets/images/big-vip.png',
height: 16,
semanticLabel: "大会员",
)
else
Text(
item.badge!,
style: TextStyle(
fontSize: 11,
color: theme.colorScheme.primary,
),
),
],
],
),
if (hasLongTitle)
Text(
isPugv ? item.title! : item.longTitle!,
maxLines: 1,
style: TextStyle(
fontSize: 13,
color: color,
),
overflow: TextOverflow.ellipsis,
),
],
),
),
),
),
);
}
}

View File

@@ -499,7 +499,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
..updateMediaListHistory(aid)
..onReset(isStein)
..bvid = bvid
..oid.value = aid
..aid = aid
..cid.value = cid
..queryVideoUrl();

View File

@@ -133,7 +133,7 @@ class _UgcIntroPanelState extends State<UgcIntroPanel>
widget.onShowMemberPage(mid);
} else {
Get.toNamed(
'/member?mid=$mid&from_view_aid=${videoDetailCtr.oid.value}',
'/member?mid=$mid&from_view_aid=${videoDetailCtr.aid}',
);
}
}
@@ -722,7 +722,7 @@ class _UgcIntroPanelState extends State<UgcIntroPanel>
widget.onShowMemberPage(ownerMid);
} else {
Get.toNamed(
'/member?mid=${item.mid}&from_view_aid=${videoDetailCtr.oid.value}',
'/member?mid=${item.mid}&from_view_aid=${videoDetailCtr.aid}',
);
}
},