Skip to content

Commit

Permalink
fix: 尝试通过分离OrientationBuilder以修复低版本安卓设备全屏旋转
Browse files Browse the repository at this point in the history
  • Loading branch information
orz12 committed Feb 18, 2024
1 parent 94f3842 commit 3a48165
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/pages/video/detail/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
}
},
);
if (!horizontalScreen) {
if (Platform.isAndroid) {
return PiPSwitcher(
childWhenDisabled: childWhenDisabled,
childWhenEnabled: childWhenEnabled,
floating: floating,
);
}
return childWhenDisabled;
}
return OrientationBuilder(
builder: (BuildContext context, Orientation orientation) {
if (orientation == Orientation.landscape) {
Expand All @@ -831,7 +841,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
return PiPSwitcher(
childWhenDisabled: Container(
key: UniqueKey(),
child: !horizontalScreen || orientation == Orientation.portrait
child: orientation == Orientation.portrait
? childWhenDisabled
: childWhenDisabledLandscape,
),
Expand All @@ -841,7 +851,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
}
return Container(
key: UniqueKey(),
child: !horizontalScreen || orientation == Orientation.portrait
child: orientation == Orientation.portrait
? childWhenDisabled
: childWhenDisabledLandscape,
);
Expand Down

0 comments on commit 3a48165

Please sign in to comment.