ardera / flutter-pi

A light-weight Flutter Engine Embedder for Raspberry Pi that runs without X.
MIT License
1.48k stars 153 forks source link

Different resolution in flutter-pi than that of the OS (DSI panel) #417

Closed DonatelloX closed 6 days ago

DonatelloX commented 2 weeks ago

I have a DSI panel on Raspberry CM4 with last kernel 6.6.28. The resolution of the DSI panel is 1364x768pixel. In the terminal I have no problem:

fbset 
mode "1364x768"
    geometry 1364 768 1364 768 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/0
endmode

the resolution seems correct.

When I run my application the resolution from flutter is only 733x413pixel. So the application does not display correctly. I tried with videomode or dimensions options but no change, the resolution in flutter enviroment is always 733x413pixel. The -r 90 option works by rotating the graphics but does not fix the resolution size.

What could be the problem in the resolution? Thank you very much

ardera commented 2 weeks ago

When I run my application the resolution from flutter is only 733x413pixel.

That's probably the resolution in logical pixels, if you multiply that with the device pixel ratio you should get the actual size in device pixels.

flutter-pi assumes, if no explicit --dimensions argument is provided, that any connected DSI display is the Raspberry Pi 7 inch screen. I'll change that so that's only assumed if the resolution is also 800x480.

Though you said you tried with --dimensions as well, does that still not work? I'm using --dimensions pretty often and it works for me. Keep in mind the argument following it should be the physical dimensions of the screen in millimeters, e.g. for the pi 7 inch screen it would be: --dimensions 155,86

DonatelloX commented 2 weeks ago

Thank you @ardera! I had something wrong in the dimensions setting, sorry for the inconvenience. I tried again with dimensions and now it's working, in particular I will use: flutter-pi -r 90 --dimensions 344,193 --release /home/pi/flutter_assets/ If possible, I think it would be much more useful to specify the resolution.

Additionally, I noticed that the Flutter application starts rotated 90° compared to the Raspberry Pi operating system. It's not a problem for me (I use the -r 90 option), but I just wanted to bring this to your attention.

Your work and your flutter-pi are greatly appreciated. Congratulations.

ardera commented 2 weeks ago

@DonatelloX Interesting, what app is this? Does it have SystemChrome.setPreferredOrientations anywhere?

DonatelloX commented 2 weeks ago

Yes, I used SystemChrome.setPreferredOrientations but it has no effect.