mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-09 19:47:57 +08:00
improve handling android window mode
Closes #1908 Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -55,6 +55,7 @@ import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/scroll_controller_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/max_screen_size.dart';
|
||||
import 'package:PiliPlus/utils/mobile_observer.dart';
|
||||
import 'package:PiliPlus/utils/num_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
@@ -453,6 +454,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
maxWidth = size.width;
|
||||
maxHeight = size.height;
|
||||
isWindowMode = MaxScreenSize.isWindowMode(
|
||||
width: maxWidth,
|
||||
height: maxHeight,
|
||||
);
|
||||
videoDetailController.plPlayerController.screenRatio = maxHeight / maxWidth;
|
||||
|
||||
final shortestSide = size.shortestSide;
|
||||
@@ -471,8 +476,9 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
: Theme.of(context);
|
||||
}
|
||||
|
||||
bool get removeAppBar =>
|
||||
videoDetailController.removeSafeArea || (isFullScreen && !isPortrait);
|
||||
bool removeAppBar(bool isFullScreen) =>
|
||||
videoDetailController.removeSafeArea ||
|
||||
(isWindowMode && isFullScreen && !isPortrait);
|
||||
|
||||
Widget get childWhenDisabled {
|
||||
return Obx(
|
||||
@@ -480,7 +486,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final isFullScreen = this.isFullScreen;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: removeAppBar
|
||||
appBar: removeAppBar(isFullScreen)
|
||||
? null
|
||||
: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(0),
|
||||
@@ -520,7 +526,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
onlyOneScrollInBody: true,
|
||||
pinnedHeaderSliverHeightBuilder: () {
|
||||
double pinnedHeight = this.isFullScreen || !isPortrait
|
||||
? maxHeight - (isPortrait ? padding.top : 0)
|
||||
? maxHeight - (isWindowMode && !isPortrait ? 0 : padding.top)
|
||||
: videoDetailController.isExpanding ||
|
||||
videoDetailController.isCollapsing
|
||||
? videoDetailController.animHeight
|
||||
@@ -546,7 +552,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
},
|
||||
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
||||
final height = isFullScreen || !isPortrait
|
||||
? maxHeight - (isPortrait ? padding.top : 0)
|
||||
? maxHeight - (isWindowMode && !isPortrait ? 0 : padding.top)
|
||||
: videoDetailController.isExpanding ||
|
||||
videoDetailController.isCollapsing
|
||||
? videoDetailController.animHeight
|
||||
@@ -782,7 +788,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final isFullScreen = this.isFullScreen;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: removeAppBar
|
||||
appBar: removeAppBar(isFullScreen)
|
||||
? null
|
||||
: AppBar(backgroundColor: Colors.black, toolbarHeight: 0),
|
||||
body: Padding(
|
||||
@@ -923,7 +929,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final videoWidth = isFullScreen ? maxWidth : width;
|
||||
final double height = width / Style.aspectRatio16x9;
|
||||
final videoHeight = isFullScreen
|
||||
? maxHeight - (isPortrait ? padding.top : 0)
|
||||
? maxHeight - (isWindowMode && !isPortrait ? 0 : padding.top)
|
||||
: height;
|
||||
if (height > maxHeight) {
|
||||
return childSplit(Style.aspectRatio16x9);
|
||||
@@ -1017,7 +1023,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final isFullScreen = this.isFullScreen;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: removeAppBar
|
||||
appBar: removeAppBar(isFullScreen)
|
||||
? null
|
||||
: AppBar(backgroundColor: Colors.black, toolbarHeight: 0),
|
||||
body: Padding(
|
||||
@@ -1049,7 +1055,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
final shouldShowSeasonPanel = _shouldShowSeasonPanel;
|
||||
final double height = maxHeight / 2.5;
|
||||
final videoHeight = isFullScreen
|
||||
? maxHeight - (isPortrait ? padding.top : 0)
|
||||
? maxHeight - (isWindowMode && !isPortrait ? 0 : padding.top)
|
||||
: height;
|
||||
final bottomHeight = maxHeight - height - padding.top;
|
||||
return Column(
|
||||
@@ -1298,6 +1304,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
late bool isPortrait;
|
||||
late double maxWidth;
|
||||
late double maxHeight;
|
||||
bool isWindowMode = false;
|
||||
late EdgeInsets padding;
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user