'How to reset the APP orientation after taking a photo?
I'm creating an iOS Landscape app by flutter.
I used image_picker to allow the app to take pictures with the camera.
After launching the camera, I rotated the device vertically and took a picture.
Then closed the camera, the APP SCREEN is still in portrait.
My hope is to automatically return to the landscape when the camera is closed.
info.plist
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
dart
final XFile? file = await _picker.pickImage(source: ImageSource.camera);
Solution 1:[1]
you can do so by adding the following after user finishes picking up image:
SystemChrome.setPreferredOrientations(DeviceOrientation.portraitUp);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tareq albeesh |
