From b4452fd7008b828e7a987d983a48d872d83fa96e Mon Sep 17 00:00:00 2001 From: orz12 Date: Sun, 18 Feb 2024 19:33:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=81=BF=E5=BC=80OrientationBuilder?= =?UTF-8?q?=E5=AF=B9=E6=9C=AA=E5=BC=80=E5=90=AF=E6=A8=AA=E5=B1=8F=E9=80=82?= =?UTF-8?q?=E9=85=8D=E7=9A=84=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/view.dart | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 203f147a..766f051d 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -822,6 +822,15 @@ class _VideoDetailPageState extends State } }, ); + if (!horizontalScreen) { + if (Platform.isAndroid) { + return PiPSwitcher( + childWhenEnabled: childWhenEnabled, + childWhenDisabled: childWhenDisabled, + floating: floating,); + } + return childWhenDisabled; + } return OrientationBuilder( builder: (BuildContext context, Orientation orientation) { if (orientation == Orientation.landscape) { @@ -829,22 +838,16 @@ class _VideoDetailPageState extends State } if (Platform.isAndroid) { return PiPSwitcher( - childWhenDisabled: Container( - key: UniqueKey(), - child: !horizontalScreen || orientation == Orientation.portrait + childWhenDisabled: orientation == Orientation.portrait ? childWhenDisabled : childWhenDisabledLandscape, - ), childWhenEnabled: childWhenEnabled, floating: floating, ); } - return Container( - key: UniqueKey(), - child: !horizontalScreen || orientation == Orientation.portrait + return orientation == Orientation.portrait ? childWhenDisabled - : childWhenDisabledLandscape, - ); + : childWhenDisabledLandscape; }); } }