opt desktop pip

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-12-14 12:20:20 +08:00
parent 2bc3275c1f
commit 02bd68f697
4 changed files with 61 additions and 12 deletions

View File

@@ -121,6 +121,26 @@ class _LiveHeaderControlState extends State<LiveHeaderControl>
child,
...?timeBatteryWidgets,
const SizedBox(width: 10),
if (Utils.isDesktop && !plPlayerController.isDesktopPip)
Obx(() {
final isAlwaysOnTop = plPlayerController.isAlwaysOnTop.value;
return ComBtn(
height: 30,
tooltip: '${isAlwaysOnTop ? '取消' : ''}置顶',
icon: isAlwaysOnTop
? const Icon(
size: 18,
Icons.push_pin,
color: Colors.white,
)
: const Icon(
size: 18,
Icons.push_pin_outlined,
color: Colors.white,
),
onTap: () => plPlayerController.setAlwaysOnTop(!isAlwaysOnTop),
);
}),
ComBtn(
height: 30,
tooltip: '发弹幕',

View File

@@ -118,12 +118,18 @@ class _MainAppState extends State<MainApp>
@override
Future<void> onWindowMoved() async {
if (PlPlayerController.instance?.isDesktopPip ?? false) {
return;
}
final Offset offset = await windowManager.getPosition();
_setting.put(SettingBoxKey.windowPosition, [offset.dx, offset.dy]);
}
@override
Future<void> onWindowResized() async {
if (PlPlayerController.instance?.isDesktopPip ?? false) {
return;
}
final Rect bounds = await windowManager.getBounds();
_setting.putAll({
SettingBoxKey.windowSize: [bounds.width, bounds.height],

View File

@@ -2567,6 +2567,33 @@ class HeaderControlState extends State<HeaderControl>
title,
// show current datetime
...?timeBatteryWidgets,
if (Utils.isDesktop && !plPlayerController.isDesktopPip)
Obx(() {
final isAlwaysOnTop = plPlayerController.isAlwaysOnTop.value;
return SizedBox(
width: 42,
height: 34,
child: IconButton(
tooltip: '${isAlwaysOnTop ? '取消' : ''}置顶',
style: const ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.zero),
),
onPressed: () =>
plPlayerController.setAlwaysOnTop(!isAlwaysOnTop),
icon: isAlwaysOnTop
? const Icon(
size: 19,
Icons.push_pin,
color: Colors.white,
)
: const Icon(
size: 19,
Icons.push_pin_outlined,
color: Colors.white,
),
),
);
}),
if (!isFileSource) ...[
if (!isFSOrPip) ...[
if (videoDetailCtr.isUgc)