fix: pip aspectRatio

related #543

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-27 20:42:06 +08:00
parent a15b932a69
commit 63a7fa95f5
5 changed files with 44 additions and 22 deletions

View File

@@ -519,14 +519,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
// }
void enterPip() {
if (Get.currentRoute.startsWith('/video')) {
videoDetailController.floating?.enable(
EnableManual(
aspectRatio: Rational(
videoDetailController.data.dash!.video!.first.width!,
videoDetailController.data.dash!.video!.first.height!,
),
),
if (Get.currentRoute.startsWith('/video') &&
videoDetailController.floating != null) {
Utils.enterPip(
videoDetailController.floating!,
videoDetailController.data.dash!.video!.first.width!,
videoDetailController.data.dash!.video!.first.height!,
);
}
}

View File

@@ -558,14 +558,12 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
// }
void enterPip() {
if (Get.currentRoute.startsWith('/video')) {
videoDetailController.floating?.enable(
EnableManual(
aspectRatio: Rational(
videoDetailController.data.dash!.video!.first.width!,
videoDetailController.data.dash!.video!.first.height!,
),
),
if (Get.currentRoute.startsWith('/video') &&
videoDetailController.floating != null) {
Utils.enterPip(
videoDetailController.floating!,
videoDetailController.data.dash!.video!.first.width!,
videoDetailController.data.dash!.video!.first.height!,
);
}
}

View File

@@ -2451,17 +2451,15 @@ class HeaderControlState extends State<HeaderControl> {
await Future.delayed(
const Duration(seconds: 3), () {});
}
final Rational aspectRatio = Rational(
if (!context.mounted) return;
Utils.enterPip(
widget.floating!,
widget
.videoDetailCtr.data.dash!.video!.first.width!,
widget
.videoDetailCtr.data.dash!.video!.first.height!,
);
if (!context.mounted) return;
await widget.floating!.enable(EnableManual(
aspectRatio: aspectRatio,
));
} else {}
}
},
icon: const Icon(
Icons.picture_in_picture_outlined,