custom keyboard control

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-09-18 18:20:23 +08:00
parent 2d625e0241
commit 9c552a89e1
6 changed files with 46 additions and 31 deletions

View File

@@ -181,8 +181,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
@override
Widget build(BuildContext context) {
if (Platform.isAndroid) {
if (Floating().isPipMode) {
if (Platform.isAndroid && Floating().isPipMode) {
return videoPlayerPanel(
isFullScreen,
width: maxWidth,
@@ -191,13 +190,15 @@ class _LiveRoomPageState extends State<LiveRoomPage>
needDm: !plPlayerController.pipNoDanmaku,
);
}
}
if (plPlayerController.keyboardControl) {
return PlayerFocus(
plPlayerController: plPlayerController,
onSendDanmaku: _liveRoomController.onSendDanmaku,
child: childWhenDisabled,
);
}
return childWhenDisabled;
}
Widget videoPlayerPanel(
bool isFullScreen, {

View File

@@ -130,6 +130,13 @@ List<SettingsModel> get playSettings => [
}
},
),
const SettingsModel(
settingsType: SettingsType.sw1tch,
title: '启用键盘控制',
leading: Icon(Icons.keyboard_alt_outlined),
setKey: SettingBoxKey.keyboardControl,
defaultVal: true,
),
const SettingsModel(
settingsType: SettingsType.sw1tch,
title: '显示 SuperChat',

View File

@@ -1484,6 +1484,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
} else {
child = autoChoose(childWhenDisabledAlmostSquare);
}
if (videoDetailController.plPlayerController.keyboardControl) {
child = PlayerFocus(
plPlayerController: videoDetailController.plPlayerController,
introController: videoDetailController.isUgc
@@ -1499,6 +1500,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
},
child: child,
);
}
return videoDetailController.plPlayerController.darkVideoPage
? Theme(data: themeData, child: child)
: child;

View File

@@ -335,6 +335,7 @@ class PlPlayerController {
late final showDmChart = Pref.showDmChart;
late final showFsScreenshotBtn = Pref.showFsScreenshotBtn;
late final showFsLockBtn = Pref.showFsLockBtn;
late final keyboardControl = Pref.keyboardControl;
late final bool autoExitFullscreen = Pref.autoExitFullscreen;
late final bool autoPlayEnable = Pref.autoPlayEnable;

View File

@@ -24,7 +24,8 @@ abstract class SettingBoxKey {
enableAutoEnter = 'enableAutoEnter',
enableAutoExit = 'enableAutoExit',
enableOnlineTotal = 'enableOnlineTotal',
showSuperChat = 'showSuperChat';
showSuperChat = 'showSuperChat',
keyboardControl = 'keyboardControl';
static const String enableVerticalExpand = 'enableVerticalExpand',
feedBackEnable = 'feedBackEnable',

View File

@@ -829,4 +829,7 @@ abstract class Pref {
static bool get isWindowMaximized =>
_setting.get(SettingBoxKey.isWindowMaximized, defaultValue: false);
static bool get keyboardControl =>
_setting.get(SettingBoxKey.keyboardControl, defaultValue: true);
}