mod: pip库-floating升级

This commit is contained in:
orz12
2024-06-18 09:47:19 +08:00
parent bedf6315b5
commit a18330e8e9
5 changed files with 31 additions and 11 deletions

View File

@@ -102,7 +102,9 @@ class _BottomControlState extends State<BottomControl> {
canUsePiP = false; canUsePiP = false;
} }
if (canUsePiP) { if (canUsePiP) {
await widget.floating!.enable(); await widget.floating!.enable(
const EnableManual()
);
} else {} } else {}
}, },
icon: const Icon( icon: const Icon(

View File

@@ -117,7 +117,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
onUserLeaveHintListener = const MethodChannel("onUserLeaveHint"); onUserLeaveHintListener = const MethodChannel("onUserLeaveHint");
onUserLeaveHintListener.setMethodCallHandler((call) async { onUserLeaveHintListener.setMethodCallHandler((call) async {
if (call.method == 'onUserLeaveHint') { if (call.method == 'onUserLeaveHint') {
if (autoPiP) { if (autoPiP &&
plPlayerController != null &&
playerStatus == PlayerStatus.playing) {
autoEnterPip(); autoEnterPip();
} }
} }
@@ -364,10 +366,17 @@ class _VideoDetailPageState extends State<VideoDetailPage>
final String routePath = Get.currentRoute; final String routePath = Get.currentRoute;
if (autoPiP && routePath.startsWith('/video')) { if (autoPiP && routePath.startsWith('/video')) {
floating.enable( floating.enable(EnableManual(
aspectRatio: Rational( aspectRatio: Rational(
videoDetailController.data.dash!.video!.first.width!, videoDetailController.data.dash!.video!.first.width!,
videoDetailController.data.dash!.video!.first.height!, videoDetailController.data.dash!.video!.first.height!,
),
sourceRectHint: Rectangle<int>(
0,
0,
context.width.toInt(),
context.height.toInt(),
),
)); ));
} }
} }

View File

@@ -1206,7 +1206,7 @@ class _HeaderControlState extends State<HeaderControl> {
}, },
)), )),
if (!isFullScreen || if (!isFullScreen ||
MediaQuery.of(context).orientation != Orientation.portrait) MediaQuery.of(context).orientation != Orientation.portrait)
SizedBox( SizedBox(
width: 42, width: 42,
height: 34, height: 34,
@@ -1420,7 +1420,16 @@ class _HeaderControlState extends State<HeaderControl> {
widget.videoDetailCtr!.data.dash!.video!.first.width!, widget.videoDetailCtr!.data.dash!.video!.first.width!,
widget.videoDetailCtr!.data.dash!.video!.first.height!, widget.videoDetailCtr!.data.dash!.video!.first.height!,
); );
await widget.floating!.enable(aspectRatio: aspectRatio); if (!context.mounted) return;
await widget.floating!.enable(EnableManual(
aspectRatio: aspectRatio,
sourceRectHint: Rectangle<int>(
0,
0,
context.width.toInt(),
context.height.toInt(),
),
));
} else {} } else {}
}, },
icon: const Icon( icon: const Icon(

View File

@@ -501,10 +501,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: floating name: floating
sha256: "04c3c96909b94dd6d2d121c69707739825e1f3dceca5ae451a9b8c0e652d246b" sha256: ddcd7f28247746dbb62997c48c89d1824118676796df47fdc6f864f8d02849bc
url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"
source: hosted source: hosted
version: "2.0.2" version: "3.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter

View File

@@ -122,7 +122,7 @@ dependencies:
# 代理 # 代理
system_proxy: ^0.1.0 system_proxy: ^0.1.0
# pip # pip
floating: ^2.0.2 floating: ^3.0.0
# html解析 # html解析
html: ^0.15.4 html: ^0.15.4
# html渲染 # html渲染