Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-09-30 11:35:42 +08:00
parent 06b258cff1
commit 299ee09749
7 changed files with 69 additions and 53 deletions

View File

@@ -2158,9 +2158,8 @@ class HeaderControlState extends State<HeaderControl> {
plPlayerController.toggleDesktopPip();
return;
}
bool canUsePiP = await Floating().isPipAvailable;
plPlayerController.hiddenControls(false);
if (canUsePiP) {
if (await Floating().isPipAvailable) {
plPlayerController.hiddenControls(false);
if (context.mounted &&
!videoPlayerServiceHandler!.enableBackgroundPlay) {
final theme = Theme.of(context);
@@ -2236,10 +2235,7 @@ class HeaderControlState extends State<HeaderControl> {
await Future.delayed(const Duration(seconds: 3));
}
if (!context.mounted) return;
PageUtils.enterPip(
width: widget.videoDetailCtr.firstVideo.width,
height: widget.videoDetailCtr.firstVideo.height,
);
plPlayerController.enterPip();
}
},
icon: const Icon(

View File

@@ -29,12 +29,12 @@ class PlayerFocus extends StatelessWidget {
final VoidCallback onSendDanmaku;
final bool Function()? canPlay;
static bool _shouldHandled(KeyEvent event) {
return event.logicalKey == LogicalKeyboardKey.tab ||
event.logicalKey == LogicalKeyboardKey.arrowLeft ||
event.logicalKey == LogicalKeyboardKey.arrowRight ||
event.logicalKey == LogicalKeyboardKey.arrowUp ||
event.logicalKey == LogicalKeyboardKey.arrowDown;
static bool _shouldHandle(LogicalKeyboardKey logicalKey) {
return logicalKey == LogicalKeyboardKey.tab ||
logicalKey == LogicalKeyboardKey.arrowLeft ||
logicalKey == LogicalKeyboardKey.arrowRight ||
logicalKey == LogicalKeyboardKey.arrowUp ||
logicalKey == LogicalKeyboardKey.arrowDown;
}
@override
@@ -43,7 +43,7 @@ class PlayerFocus extends StatelessWidget {
autofocus: true,
onKeyEvent: (node, event) {
final handled = _handleKey(event);
if (handled || _shouldHandled(event)) {
if (handled || _shouldHandle(event.logicalKey)) {
return KeyEventResult.handled;
}
return KeyEventResult.ignored;