refa: download video (#1737)

* opt: save pb danmaku

* refa: download video

* opt: replaceAll

* fix: wait delete

* opt: remove completer

* fix: index.json

* tweaks

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

---------

Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2025-11-12 19:12:17 +08:00
committed by GitHub
parent 37b1228552
commit 407b31c5c1
16 changed files with 345 additions and 410 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/common/widgets/badge.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
@@ -6,8 +8,11 @@ import 'package:PiliPlus/models/common/video/video_quality.dart';
import 'package:PiliPlus/models_new/download/bili_download_entry_info.dart';
import 'package:PiliPlus/pages/video/introduction/local/controller.dart';
import 'package:PiliPlus/utils/duration_utils.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/path_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:path/path.dart' as path;
class LocalIntroPanel extends StatefulWidget {
const LocalIntroPanel({super.key, required this.heroTag});
@@ -49,6 +54,7 @@ class _LocalIntroPanelState extends State<LocalIntroPanel>
BiliDownloadEntryInfo entry,
) {
final outline = theme.colorScheme.outline;
final cover = File(path.join(entry.entryDirPath, PathUtils.coverName));
return Padding(
padding: const EdgeInsets.only(bottom: 2),
child: SizedBox(
@@ -73,11 +79,28 @@ class _LocalIntroPanelState extends State<LocalIntroPanel>
Stack(
clipBehavior: Clip.none,
children: [
NetworkImgLayer(
src: entry.cover,
width: 140.8,
height: 88,
),
cover.existsSync()
? ClipRRect(
borderRadius: StyleString.mdRadius,
child: Image.file(
cover,
width: 140.8,
height: 88,
fit: BoxFit.cover,
cacheHeight: 140.8.cacheSize(context),
colorBlendMode: NetworkImgLayer.reduce
? BlendMode.modulate
: null,
color: NetworkImgLayer.reduce
? NetworkImgLayer.reduceLuxColor
: null,
),
)
: NetworkImgLayer(
src: entry.cover,
width: 140.8,
height: 88,
),
PBadge(
text: DurationUtils.formatDuration(
entry.totalTimeMilli ~/ 1000,