mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 修复全屏异常,移除Obx中的全屏与退出相关逻辑,统一至监听器中
This commit is contained in:
@@ -96,6 +96,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
appbarStreamListen();
|
appbarStreamListen();
|
||||||
lifecycleListener();
|
lifecycleListener();
|
||||||
fullScreenStatusListener();
|
fullScreenStatusListener();
|
||||||
|
autoScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取视频资源,初始化播放器
|
// 获取视频资源,初始化播放器
|
||||||
@@ -188,10 +189,19 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
plPlayerController?.isFullScreen.listen((bool isFullScreen) {
|
plPlayerController?.isFullScreen.listen((bool isFullScreen) {
|
||||||
if (isFullScreen) {
|
if (isFullScreen) {
|
||||||
videoDetailController.hiddenReplyReplyPanel();
|
videoDetailController.hiddenReplyReplyPanel();
|
||||||
|
enterFullScreen();
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
this.isFullScreen.value = isFullScreen;
|
this.isFullScreen.value = isFullScreen;
|
||||||
});
|
});
|
||||||
|
if (!isFullScreen) {
|
||||||
|
exitFullScreen();
|
||||||
|
if (setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||||
|
autoScreen();
|
||||||
|
} else {
|
||||||
|
verticalScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +300,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Widget childWhenDisabled = SafeArea(
|
Widget childWhenDisabled = SafeArea(
|
||||||
@@ -317,13 +326,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Obx(
|
Obx(
|
||||||
() {
|
() {
|
||||||
if (MediaQuery.of(context).orientation ==
|
|
||||||
Orientation.landscape ||
|
|
||||||
isFullScreen.value == true) {
|
|
||||||
enterFullScreen();
|
|
||||||
} else {
|
|
||||||
exitFullScreen();
|
|
||||||
}
|
|
||||||
final double videoheight = Get.width * 9 / 16;
|
final double videoheight = Get.width * 9 / 16;
|
||||||
final double videowidth = Get.width;
|
final double videowidth = Get.width;
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
@@ -826,32 +828,37 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (!horizontalScreen) {
|
// if (!horizontalScreen) {
|
||||||
if (Platform.isAndroid) {
|
// if (Platform.isAndroid) {
|
||||||
return PiPSwitcher(
|
// return PiPSwitcher(
|
||||||
childWhenEnabled: childWhenEnabled,
|
// childWhenEnabled: childWhenEnabled,
|
||||||
childWhenDisabled: childWhenDisabled,
|
// childWhenDisabled: childWhenDisabled,
|
||||||
floating: floating,);
|
// floating: floating,);
|
||||||
}
|
// }
|
||||||
return childWhenDisabled;
|
// return childWhenDisabled;
|
||||||
}
|
// }
|
||||||
return OrientationBuilder(
|
return OrientationBuilder(
|
||||||
builder: (BuildContext context, Orientation orientation) {
|
builder: (BuildContext context, Orientation orientation) {
|
||||||
|
print("orientation $orientation");
|
||||||
if (orientation == Orientation.landscape) {
|
if (orientation == Orientation.landscape) {
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
|
if (!horizontalScreen) {
|
||||||
|
videoDetailController.hiddenReplyReplyPanel();
|
||||||
|
}
|
||||||
} else if (!isFullScreen.value) {
|
} else if (!isFullScreen.value) {
|
||||||
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
|
||||||
}
|
}
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
return PiPSwitcher(
|
return PiPSwitcher(
|
||||||
childWhenDisabled: orientation == Orientation.portrait
|
childWhenDisabled:
|
||||||
|
!horizontalScreen || orientation == Orientation.portrait
|
||||||
? childWhenDisabled
|
? childWhenDisabled
|
||||||
: childWhenDisabledLandscape,
|
: childWhenDisabledLandscape,
|
||||||
childWhenEnabled: childWhenEnabled,
|
childWhenEnabled: childWhenEnabled,
|
||||||
floating: floating,
|
floating: floating,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return orientation == Orientation.portrait
|
return !horizontalScreen || orientation == Orientation.portrait
|
||||||
? childWhenDisabled
|
? childWhenDisabled
|
||||||
: childWhenDisabledLandscape;
|
: childWhenDisabledLandscape;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -75,11 +75,6 @@ Future<void> exitFullScreen() async {
|
|||||||
mode,
|
mode,
|
||||||
overlays: SystemUiOverlay.values,
|
overlays: SystemUiOverlay.values,
|
||||||
);
|
);
|
||||||
if (setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
|
||||||
autoScreen();
|
|
||||||
} else {
|
|
||||||
verticalScreen();
|
|
||||||
}
|
|
||||||
} else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
} else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
||||||
await const MethodChannel('com.alexmercerind/media_kit_video')
|
await const MethodChannel('com.alexmercerind/media_kit_video')
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
|
|||||||
Reference in New Issue
Block a user