cache season fav state

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-19 23:31:08 +08:00
parent 5bcd822251
commit a0f3b3e442
11 changed files with 55 additions and 49 deletions

View File

@@ -1721,7 +1721,9 @@ class PlPlayerController {
disableAutoEnterPip();
setPlayCallBack(null);
dmState.clear();
_clearPreview();
if (showSeekPreview) {
_clearPreview();
}
Utils.channel.setMethodCallHandler(null);
_timer?.cancel();
_timerForSeek?.cancel();
@@ -1744,6 +1746,9 @@ class PlPlayerController {
}
await removeListeners();
subscriptions.clear();
_positionListeners.clear();
_statusListeners.clear();
if (playerStatus.playing) {
WakelockPlus.disable();
}
@@ -1779,7 +1784,7 @@ class PlPlayerController {
);
}
final Map<String, ui.Image?> previewCache = {};
late final Map<String, ui.Image?> previewCache = {};
LoadingState<VideoShotData>? videoShot;
late final RxBool showPreview = false.obs;
late final showSeekPreview = Pref.showSeekPreview;

View File

@@ -1846,6 +1846,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
plPlayerController,
maxWidth,
maxHeight,
() => mounted,
),
if (isFullScreen || plPlayerController.isDesktopPip) ...[
@@ -2537,6 +2538,7 @@ Widget buildSeekPreviewWidget(
PlPlayerController plPlayerController,
double maxWidth,
double maxHeight,
ValueGetter<bool> isMounted,
) {
return Obx(
() {
@@ -2591,6 +2593,7 @@ Widget buildSeekPreviewWidget(
onSetSize: (xSize, ySize) => data
..imgXSize = imgXSize = xSize
..imgYSize = imgYSize = ySize,
isMounted: isMounted,
),
);
},
@@ -2615,6 +2618,7 @@ class VideoShotImage extends StatefulWidget {
required this.imgYSize,
required this.height,
required this.onSetSize,
required this.isMounted,
});
final Map<String, ui.Image?> imageCache;
@@ -2625,6 +2629,7 @@ class VideoShotImage extends StatefulWidget {
final double imgYSize;
final double height;
final Function(double imgXSize, double imgYSize) onSetSize;
final ValueGetter<bool> isMounted;
@override
State<VideoShotImage> createState() => _VideoShotImageState();
@@ -2707,7 +2712,9 @@ class _VideoShotImageState extends State<VideoShotImage> {
widget.imageCache[url] = null;
_getImg(url).then((image) {
if (image != null) {
widget.imageCache[url] = image;
if (widget.isMounted()) {
widget.imageCache[url] = image;
}
if (mounted) {
_image = image;
_initSizeIfNeeded();