mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 12:10:33 +08:00
mod: 进一步解耦,将heroTag替换为UniqueKey
This commit is contained in:
@@ -112,15 +112,13 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
// print(StackTrace.current);
|
// print(StackTrace.current);
|
||||||
if (!PlPlayerController.instanceExists()) return;
|
if (!PlPlayerController.instanceExists()) return;
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
if (Get.arguments == null || Get.arguments['heroTag'] == null) return;
|
|
||||||
final heroTag = Get.arguments['heroTag'];
|
|
||||||
|
|
||||||
late MediaItem? mediaItem;
|
late MediaItem? mediaItem;
|
||||||
if (data is VideoDetailData) {
|
if (data is VideoDetailData) {
|
||||||
if ((data.pages?.length ?? 0) > 1) {
|
if ((data.pages?.length ?? 0) > 1) {
|
||||||
final current = data.pages?.firstWhere((element) => element.cid == cid);
|
final current = data.pages?.firstWhere((element) => element.cid == cid);
|
||||||
mediaItem = MediaItem(
|
mediaItem = MediaItem(
|
||||||
id: heroTag,
|
id: UniqueKey().toString(),
|
||||||
title: current?.pagePart ?? "",
|
title: current?.pagePart ?? "",
|
||||||
artist: data.title ?? "",
|
artist: data.title ?? "",
|
||||||
album: data.title ?? "",
|
album: data.title ?? "",
|
||||||
@@ -129,7 +127,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
mediaItem = MediaItem(
|
mediaItem = MediaItem(
|
||||||
id: heroTag,
|
id: UniqueKey().toString(),
|
||||||
title: data.title ?? "",
|
title: data.title ?? "",
|
||||||
artist: data.owner?.name ?? "",
|
artist: data.owner?.name ?? "",
|
||||||
duration: Duration(seconds: data.duration ?? 0),
|
duration: Duration(seconds: data.duration ?? 0),
|
||||||
@@ -140,7 +138,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
final current =
|
final current =
|
||||||
data.episodes?.firstWhere((element) => element.cid == cid);
|
data.episodes?.firstWhere((element) => element.cid == cid);
|
||||||
mediaItem = MediaItem(
|
mediaItem = MediaItem(
|
||||||
id: heroTag,
|
id: UniqueKey().toString(),
|
||||||
title: current?.longTitle ?? "",
|
title: current?.longTitle ?? "",
|
||||||
artist: data.title ?? "",
|
artist: data.title ?? "",
|
||||||
duration: Duration(milliseconds: current?.duration ?? 0),
|
duration: Duration(milliseconds: current?.duration ?? 0),
|
||||||
@@ -148,7 +146,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (mediaItem == null) return;
|
if (mediaItem == null) return;
|
||||||
print("exist: ${PlPlayerController.instanceExists()}");
|
// print("exist: ${PlPlayerController.instanceExists()}");
|
||||||
if (!PlPlayerController.instanceExists()) return;
|
if (!PlPlayerController.instanceExists()) return;
|
||||||
setMediaItem(mediaItem);
|
setMediaItem(mediaItem);
|
||||||
_item.add(mediaItem);
|
_item.add(mediaItem);
|
||||||
|
|||||||
Reference in New Issue
Block a user