I have developed with flutter and i have a problem in Device Rotation.
for example, when an user clicked a button, it makes rotate device.(below code)
SystemChrome.setPreferredOrientations(
_isPortrait
? [
DeviceOrientation.landscapeRight,
]
: [
DeviceOrientation.portraitUp,
],
)
and end of rotation, i will change rotation landscape + portrait(to rotate user device directly)
so i used following code.
SystemChrome.setPreferredOrientations(
_isPortrait
? [
DeviceOrientation.landscapeRight,
]
: [
DeviceOrientation.portraitUp,
],
).then((value) {
SystemChrome.setPreferredOrientations([]);
});
It is working under iOS16.
But in iOS16, it is not working.(after change rotation, it is rollback origin rotation with animation)
Who know this problem?
Thanks.
Previously apple was using
UIDevice.current.setValue(value, forKey: "orientation")
to set the orientation after iOS 16 the mentioned method got deprecated because of some bugs, instead of that they are recommending us to use windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: orientation))
this method. for the further reference https://developer.apple.com/forums/thread/707735?answerId=726322022#726322022