'Screen orientation in flutter on android devices works wrong
In my flutter app I need a two screen orientation types. Some screens must be a portrait up and some screens must be portrait up and landscape left. So, in build method I use SystemChrome.setPreferredOrientations. If I set
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.portraitUp,
DeviceOrientation.landscapeRight, ]);
that's ok. But if I set only two orientations
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.portraitUp, ]);
that's ok on iPhone devices, but on android device screen opens with first orientation from list only and doesn't rotate to the second one. So in this case it always will be landscapeLeft regardless of the phone position and will not rotate to portrait.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
