Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to detect rotation of device with Android Emulator for Flutter app?

I’m trying to make my mobile app responsive to device rotation, and I’m starting by checking the current rotation of the screen with a print of MediaQuery.of(context).orientation in my build.

When my emulator is vertical it indicate that my orientation is in "portrait" :

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

And when I click on the button to rotate it to horizontal :
enter image description here

  1. it doesn’t rebuild
  2. when I relaunch from an horizontal rotation it still indicate me that the orientation (of MediaQuery.of(context).orientation) is in "portrait"

I would like that my app actually detect the rotation to start, if anyone knows how I will take it.

Thanks.

>Solution :

The Orientation of an Emulator is by default locked, so you should simply try if enabling rotation you application work as intended, in order to do so simply swipe down on the phone system bar and locate the orientation button

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading