feat: video download

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-06 12:12:32 +08:00
parent 976622df89
commit ffd4f9ee73
92 changed files with 4853 additions and 946 deletions

View File

@@ -6,6 +6,7 @@ import 'package:PiliPlus/pages/video/controller.dart';
import 'package:PiliPlus/pages/video/introduction/ugc/controller.dart';
import 'package:PiliPlus/utils/id_utils.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
// TODO refa
@@ -18,6 +19,8 @@ class PagesPanel extends StatefulWidget {
required this.heroTag,
this.showEpisodes,
required this.ugcIntroController,
this.onDownload,
this.cidSet,
});
final List<Part>? list;
@@ -28,6 +31,9 @@ class PagesPanel extends StatefulWidget {
final Function? showEpisodes;
final UgcIntroController ugcIntroController;
final Set<int?>? cidSet;
final bool Function(Part part)? onDownload;
@override
State<PagesPanel> createState() => _PagesPanelState();
}
@@ -105,7 +111,7 @@ class _PagesPanelState extends State<PagesPanel> {
const Text('视频选集 '),
Expanded(
child: Text(
' 正在播放:${pages[pageIndex].pagePart}',
' 正在播放:${pages[pageIndex].part}',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12,
@@ -160,6 +166,12 @@ class _PagesPanelState extends State<PagesPanel> {
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(6)),
onTap: () {
if (widget.onDownload case final onDownload?) {
if (onDownload(item) && mounted) {
setState(() {});
}
return;
}
if (widget.showEpisodes == null) {
Get.back();
}
@@ -193,7 +205,7 @@ class _PagesPanelState extends State<PagesPanel> {
],
Expanded(
child: Text(
item.pagePart!,
item.part!,
maxLines: 1,
style: TextStyle(
fontSize: 13,
@@ -204,6 +216,14 @@ class _PagesPanelState extends State<PagesPanel> {
overflow: TextOverflow.ellipsis,
),
),
if (widget.cidSet?.contains(item.cid) ?? false)
Icon(
size: 13,
color: theme.colorScheme.secondary.withValues(
alpha: 0.8,
),
FontAwesomeIcons.circleDown,
),
],
),
),