android – In flutter how can I lock orientation however make exceptions for sure widgets/elements?


I wish to lock the orientation of my complete app to portrait. That is fantastic, I’ve executed that utilizing the next:

await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);

That every one works, however one in every of my pages is a digicam characteristic. The consumer will, naturally, wish to rotate their telephone to panorama for a panorama image. I’d nonetheless prefer to maintain all components on the web page portrait, other than among the icons. Android’s native digicam app achieves this. How can I?

My understanding is the orientation override I am utilizing means the app might by no means understand it was in panorama – is that right?

What I’ve Tried

I’ve tried solely locking the orientation at a widget stage for this specific web page however that also applies it globally.

I’ve additionally debated turning most popular orientation off for this web page, and duplicating all components – rotating some 90 levels for the needs of mimicking the portrait mode in panorama, however that’s lots of work and, I’d guess, pointless.

For Bonus Factors

I am really working from ‘flutterflow’, it would be incredible if this could possibly be achieved there, I am guessing not although.


Leave a Reply