mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: fullscreen
maybe fix failed to hide statusbar in fullscreen mode
This commit is contained in:
@@ -88,8 +88,6 @@ class VideoDetailController extends GetxController
|
|||||||
late String cacheSecondDecode;
|
late String cacheSecondDecode;
|
||||||
late int cacheAudioQa;
|
late int cacheAudioQa;
|
||||||
|
|
||||||
PersistentBottomSheetController? replyReplyBottomSheetCtr;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -494,11 +492,4 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mob端全屏状态关闭二级回复
|
|
||||||
hiddenReplyReplyPanel() {
|
|
||||||
replyReplyBottomSheetCtr != null
|
|
||||||
? replyReplyBottomSheetCtr!.close()
|
|
||||||
: print('replyReplyBottomSheetCtr is null');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,10 +81,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// 生命周期监听
|
// 生命周期监听
|
||||||
// late final AppLifecycleListener _lifecycleListener;
|
// late final AppLifecycleListener _lifecycleListener;
|
||||||
bool isShowing = true;
|
bool isShowing = true;
|
||||||
RxBool isFullScreen = false.obs;
|
|
||||||
late StreamSubscription<bool> fullScreenStatusListener;
|
|
||||||
late final MethodChannel onUserLeaveHintListener;
|
late final MethodChannel onUserLeaveHintListener;
|
||||||
// StreamSubscription<Duration>? _bufferedListener;
|
// StreamSubscription<Duration>? _bufferedListener;
|
||||||
|
bool get isFullScreen => plPlayerController?.isFullScreen.value ?? false;
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
@@ -176,7 +175,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
if (videoDetailController.autoPlay.value) {
|
if (videoDetailController.autoPlay.value) {
|
||||||
plPlayerController = videoDetailController.plPlayerController;
|
plPlayerController = videoDetailController.plPlayerController;
|
||||||
plPlayerController!.addStatusLister(playerListener);
|
plPlayerController!.addStatusLister(playerListener);
|
||||||
listenFullScreenStatus();
|
|
||||||
await plPlayerController!.autoEnterFullscreen();
|
await plPlayerController!.autoEnterFullscreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,7 +244,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoDetailController.isShowCover.value = false;
|
videoDetailController.isShowCover.value = false;
|
||||||
await videoDetailController.playerInit();
|
await videoDetailController.playerInit();
|
||||||
plPlayerController!.addStatusLister(playerListener);
|
plPlayerController!.addStatusLister(playerListener);
|
||||||
listenFullScreenStatus();
|
|
||||||
await plPlayerController!.autoEnterFullscreen();
|
await plPlayerController!.autoEnterFullscreen();
|
||||||
videoDetailController.autoPlay.value = true;
|
videoDetailController.autoPlay.value = true;
|
||||||
}
|
}
|
||||||
@@ -272,28 +269,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void listenFullScreenStatus() {
|
|
||||||
fullScreenStatusListener =
|
|
||||||
plPlayerController!.isFullScreen.listen((bool status) {
|
|
||||||
if (status) {
|
|
||||||
videoDetailController.hiddenReplyReplyPanel();
|
|
||||||
// hideStatusBar();
|
|
||||||
}
|
|
||||||
isFullScreen.value = status;
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
// if (!status) {
|
|
||||||
// showStatusBar();
|
|
||||||
// if (horizontalScreen) {
|
|
||||||
// autoScreen();
|
|
||||||
// } else {
|
|
||||||
// verticalScreenForTwoSeconds();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (!Get.previousRoute.startsWith('/video')) {
|
if (!Get.previousRoute.startsWith('/video')) {
|
||||||
@@ -312,7 +287,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// _bufferedListener?.cancel();
|
// _bufferedListener?.cancel();
|
||||||
if (plPlayerController != null) {
|
if (plPlayerController != null) {
|
||||||
plPlayerController!.removeStatusLister(playerListener);
|
plPlayerController!.removeStatusLister(playerListener);
|
||||||
fullScreenStatusListener.cancel();
|
|
||||||
plPlayerController!.dispose();
|
plPlayerController!.dispose();
|
||||||
} else {
|
} else {
|
||||||
PlPlayerController.updatePlayCount();
|
PlPlayerController.updatePlayCount();
|
||||||
@@ -341,7 +315,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoDetailController.defaultST = plPlayerController!.position.value;
|
videoDetailController.defaultST = plPlayerController!.position.value;
|
||||||
videoIntroController.isPaused = true;
|
videoIntroController.isPaused = true;
|
||||||
plPlayerController!.removeStatusLister(playerListener);
|
plPlayerController!.removeStatusLister(playerListener);
|
||||||
fullScreenStatusListener.cancel();
|
|
||||||
plPlayerController!.pause();
|
plPlayerController!.pause();
|
||||||
}
|
}
|
||||||
isShowing = false;
|
isShowing = false;
|
||||||
@@ -398,9 +371,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
AutoOrientation.fullAutoMode();
|
AutoOrientation.fullAutoMode();
|
||||||
});
|
});
|
||||||
plPlayerController?.addStatusLister(playerListener);
|
plPlayerController?.addStatusLister(playerListener);
|
||||||
if (plPlayerController != null) {
|
|
||||||
listenFullScreenStatus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -439,12 +409,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
Widget get childWhenDisabled => SafeArea(
|
Widget get childWhenDisabled => SafeArea(
|
||||||
top: !removeSafeArea &&
|
top: !removeSafeArea &&
|
||||||
MediaQuery.of(context).orientation == Orientation.portrait &&
|
MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||||
isFullScreen.value == true,
|
isFullScreen,
|
||||||
bottom: !removeSafeArea &&
|
bottom: !removeSafeArea &&
|
||||||
MediaQuery.of(context).orientation == Orientation.portrait &&
|
MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||||
isFullScreen.value == true,
|
isFullScreen,
|
||||||
left: false, //isFullScreen != true,
|
left: false, //!isFullScreen,
|
||||||
right: false, //isFullScreen != true,
|
right: false, //!isFullScreen,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Scaffold(
|
Scaffold(
|
||||||
@@ -480,24 +450,24 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape &&
|
Orientation.landscape &&
|
||||||
!horizontalScreen &&
|
!horizontalScreen &&
|
||||||
!isFullScreen.value &&
|
!isFullScreen &&
|
||||||
isShowing &&
|
isShowing &&
|
||||||
mounted) {
|
mounted) {
|
||||||
hideStatusBar();
|
hideStatusBar();
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
// if (MediaQuery.of(context).orientation ==
|
||||||
Orientation.portrait &&
|
// Orientation.portrait &&
|
||||||
!isFullScreen.value &&
|
// !isFullScreen &&
|
||||||
isShowing &&
|
// isShowing &&
|
||||||
mounted) {
|
// mounted) {
|
||||||
if (!removeSafeArea) showStatusBar();
|
// if (!removeSafeArea) showStatusBar();
|
||||||
}
|
// }
|
||||||
return Container(
|
return Container(
|
||||||
color:
|
color:
|
||||||
showStatusBarBackgroundColor ? null : Colors.black,
|
showStatusBarBackgroundColor ? null : Colors.black,
|
||||||
height: MediaQuery.of(context).orientation ==
|
height: MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape ||
|
Orientation.landscape ||
|
||||||
isFullScreen.value == true
|
isFullScreen
|
||||||
? MediaQuery.sizeOf(context).height -
|
? MediaQuery.sizeOf(context).height -
|
||||||
(MediaQuery.of(context).orientation ==
|
(MediaQuery.of(context).orientation ==
|
||||||
Orientation.landscape ||
|
Orientation.landscape ||
|
||||||
@@ -507,13 +477,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
: videoHeight,
|
: videoHeight,
|
||||||
width: context.width,
|
width: context.width,
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: isFullScreen.value != true &&
|
canPop: !isFullScreen &&
|
||||||
(horizontalScreen ||
|
(horizontalScreen ||
|
||||||
MediaQuery.of(context).orientation ==
|
MediaQuery.of(context).orientation ==
|
||||||
Orientation.portrait),
|
Orientation.portrait),
|
||||||
onPopInvokedWithResult:
|
onPopInvokedWithResult:
|
||||||
(bool didPop, Object? result) {
|
(bool didPop, Object? result) {
|
||||||
if (isFullScreen.value == true) {
|
if (isFullScreen) {
|
||||||
plPlayerController!
|
plPlayerController!
|
||||||
.triggerFullScreen(status: false);
|
.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
@@ -569,12 +539,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: videoHeight,
|
height: videoHeight,
|
||||||
width:
|
width: isFullScreen ? context.width : videoWidth,
|
||||||
isFullScreen.value == true ? context.width : videoWidth,
|
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: isFullScreen.value != true,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
if (isFullScreen.value == true) {
|
if (isFullScreen) {
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
plPlayerController!.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
@@ -615,7 +584,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: videoWidth,
|
width: videoWidth,
|
||||||
height: isFullScreen.value == true
|
height: isFullScreen
|
||||||
? context.height -
|
? context.height -
|
||||||
(removeSafeArea
|
(removeSafeArea
|
||||||
? 0
|
? 0
|
||||||
@@ -623,9 +592,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
MediaQuery.of(context).padding.bottom))
|
MediaQuery.of(context).padding.bottom))
|
||||||
: videoHeight,
|
: videoHeight,
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: isFullScreen.value != true,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
if (isFullScreen.value == true) {
|
if (isFullScreen) {
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
plPlayerController!.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
@@ -674,12 +643,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
Expanded(child: videoIntro()),
|
Expanded(child: videoIntro()),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: videoHeight,
|
height: videoHeight,
|
||||||
width:
|
width: isFullScreen ? context.width : videoWidth,
|
||||||
isFullScreen.value == true ? context.width : videoWidth,
|
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: isFullScreen.value != true,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
if (isFullScreen.value == true) {
|
if (isFullScreen) {
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
plPlayerController!.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
@@ -750,15 +718,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width:
|
width: isFullScreen ? context.width : videoWidth,
|
||||||
isFullScreen.value == true ? context.width : videoWidth,
|
height: isFullScreen ? context.height : videoHeight,
|
||||||
height: isFullScreen.value == true
|
|
||||||
? context.height
|
|
||||||
: videoHeight,
|
|
||||||
child: PopScope(
|
child: PopScope(
|
||||||
canPop: isFullScreen.value != true,
|
canPop: !isFullScreen,
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
if (isFullScreen.value == true) {
|
if (isFullScreen) {
|
||||||
plPlayerController!.triggerFullScreen(status: false);
|
plPlayerController!.triggerFullScreen(status: false);
|
||||||
}
|
}
|
||||||
if (MediaQuery.of(context).orientation ==
|
if (MediaQuery.of(context).orientation ==
|
||||||
@@ -771,7 +736,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Offstage(
|
Offstage(
|
||||||
offstage: isFullScreen.value == true,
|
offstage: isFullScreen,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: videoWidth,
|
width: videoWidth,
|
||||||
height: context.height -
|
height: context.height -
|
||||||
@@ -785,7 +750,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Offstage(
|
Offstage(
|
||||||
offstage: isFullScreen.value == true,
|
offstage: isFullScreen,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: (context.width -
|
width: (context.width -
|
||||||
videoWidth -
|
videoWidth -
|
||||||
@@ -857,8 +822,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
body: Container(
|
body: Container(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
left: !removeSafeArea && isFullScreen.value != true,
|
left: !removeSafeArea && !isFullScreen,
|
||||||
right: !removeSafeArea && isFullScreen.value != true,
|
right: !removeSafeArea && !isFullScreen,
|
||||||
top: !removeSafeArea,
|
top: !removeSafeArea,
|
||||||
bottom: false, //!removeSafeArea,
|
bottom: false, //!removeSafeArea,
|
||||||
child: childWhenDisabledLandscapeInner),
|
child: childWhenDisabledLandscapeInner),
|
||||||
@@ -890,8 +855,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
body: Container(
|
body: Container(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
left: !removeSafeArea && isFullScreen.value != true,
|
left: !removeSafeArea && !isFullScreen,
|
||||||
right: !removeSafeArea && isFullScreen.value != true,
|
right: !removeSafeArea && !isFullScreen,
|
||||||
top: !removeSafeArea,
|
top: !removeSafeArea,
|
||||||
bottom: false, //!removeSafeArea,
|
bottom: false, //!removeSafeArea,
|
||||||
child: childWhenDisabledAlmostSquareInner)))
|
child: childWhenDisabledAlmostSquareInner)))
|
||||||
@@ -1062,14 +1027,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
return autoChoose(childWhenDisabledLandscape);
|
return autoChoose(childWhenDisabledLandscape);
|
||||||
} else if (constraints.maxWidth * (9 / 16) <
|
} else if (constraints.maxWidth * (9 / 16) <
|
||||||
(2 / 5) * constraints.maxHeight) {
|
(2 / 5) * constraints.maxHeight) {
|
||||||
if (!isFullScreen.value) {
|
// if (!isFullScreen) {
|
||||||
if (!removeSafeArea) showStatusBar();
|
// if (!removeSafeArea) showStatusBar();
|
||||||
}
|
// }
|
||||||
return autoChoose(childWhenDisabled);
|
return autoChoose(childWhenDisabled);
|
||||||
} else {
|
} else {
|
||||||
if (!isFullScreen.value) {
|
// if (!isFullScreen) {
|
||||||
if (!removeSafeArea) showStatusBar();
|
// if (!removeSafeArea) showStatusBar();
|
||||||
}
|
// }
|
||||||
return autoChoose(childWhenDisabledAlmostSquare);
|
return autoChoose(childWhenDisabledAlmostSquare);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@@ -1083,7 +1048,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// videoDetailController.hiddenReplyReplyPanel();
|
// videoDetailController.hiddenReplyReplyPanel();
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// if (!isFullScreen.value) {
|
// if (!isFullScreen) {
|
||||||
// showStatusBar();
|
// showStatusBar();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
@@ -1341,7 +1306,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
currentCid: cid,
|
currentCid: cid,
|
||||||
changeFucCall: videoIntroController.changeSeasonOrbangu,
|
changeFucCall: videoIntroController.changeSeasonOrbangu,
|
||||||
context: context,
|
context: context,
|
||||||
scaffoldState: isFullScreen.value
|
scaffoldState: isFullScreen
|
||||||
? videoDetailController.scaffoldKey.currentState
|
? videoDetailController.scaffoldKey.currentState
|
||||||
: scaffoldKey.currentState,
|
: scaffoldKey.currentState,
|
||||||
).buildShowBottomSheet();
|
).buildShowBottomSheet();
|
||||||
|
|||||||
Reference in New Issue
Block a user