tat_flutter
tat_flutter copied to clipboard
Bug: [iOS] Orientation seems able to be changed now
Describe the bug The display orientation seems can be changed to landscape mode in all places, which is not allowed by our policy.
To Reproduce Steps to reproduce the behavior:
- go to course table page
- check if it can show in landscape mode.
Expected behavior not allowed landscape mode, except the video player page.
The problem is that even we used the SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
, the orientation is still able to be changed in iOS devices. There's a workaround: restrict the config to only the portrait mode in the Info.plist
file, but that makes we can't change the orientation while we need it (the video player page.)
This is insane. Requested to dive into the native flutter code.
Native code land point: the SystemMethodChannel
for the setPreferredOrientations
method call. (iOS)
Flutter 3.7.2
static Future<void> setPreferredOrientations(List<DeviceOrientation> orientations) async {
await SystemChannels.platform.invokeMethod<void>(
'SystemChrome.setPreferredOrientations',
_stringify(orientations),
);
}
https://developer.apple.com/forums/thread/707735
https://developer.apple.com/documentation/uikit/uiviewcontroller/1621438-preferredinterfaceorientationfor