sososdk/flutter_orientation

SystemChrome does not work when usign plugin

Closed this issue · 5 comments

SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]).then((_) {
    runApp(MyApp());
});

Wont work if using this plugin, and using this code wont too:

OrientationPlugin.forceOrientation(DeviceOrientation.portraitUp).then((_){
    runApp(MyApp());
});

The app always rotates no matter what.

forceOrientation just lets the screen go to the specified direction, without limiting the screen rotation.

I think you need OrientationPlugin.setPreferredOrientations([DeviceOrientation.portraitUp]).

@sososdk I have used that before testing with forceOrientation, same result.

@marianoarga Do you want to lock the screen orientation? And what is you platform?

@sososdk Yes, the goal is to have the orientation locked, but listen for orientation phisical change.
I have already locked the orientation with SystemChrome.setPreferredOrientations in previous app versions, but when I add the plugin that stops working.
Android is the platform.

Btw, I have achieve my goal migrating to native_device_orientation plugin, just for you to know and maybe check it out.

Thank you.

@marianoarga If you are interested you can check out example, I think it can achieve your purpose.

Thank you.