tat_flutter icon indicating copy to clipboard operation
tat_flutter copied to clipboard

Bug: [iOS] Orientation seems able to be changed now

Open Xanonymous-GitHub opened this issue 2 years ago • 3 comments

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:

  1. go to course table page
  2. check if it can show in landscape mode.

Expected behavior not allowed landscape mode, except the video player page.

Xanonymous-GitHub avatar Jan 29 '23 20:01 Xanonymous-GitHub

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.)

Xanonymous-GitHub avatar Feb 12 '23 15:02 Xanonymous-GitHub

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),
    );
  }

Xanonymous-GitHub avatar Feb 12 '23 15:02 Xanonymous-GitHub

https://developer.apple.com/forums/thread/707735

https://developer.apple.com/documentation/uikit/uiviewcontroller/1621438-preferredinterfaceorientationfor

Xanonymous-GitHub avatar Feb 12 '23 16:02 Xanonymous-GitHub