Cover image for How to limit window resize in Flutter Desktop

How to limit window resize in Flutter Desktop

_regnex profile image Etornam🤴🏽🇬🇭 ・2 min read

Hi there!
It has been such a looooong time since I wrote an article or even created a youtube ☹️ tutorial but hey, there’s good news 🎤, I’M BACK 🔥🔥🔥.

In the past few weeks, I have been working on a Desktop app using Flutter (you know one of those side projects you start then drop it then pick it up again…? yeaaaah!) and I had problems with the window screen resizing.
At some point, you can resize it such that nothing else displays which is an undesirable feature. Hence I started doing some research on how to limit the resize of the window.
Alt Text
After talking to a number of developers and also reading some articles, this effect can “only” be done natively. This requires editing some files for the MacOS, Windows and Linux file folder. This will be a bit stressful especially if the developer is not accustomed to these platforms, I did a deeper research by looking at the source code of existing Flutter desktop applications (FVM GUI) and discovered a google package that does it all for you 🔥🔥🔥 (flutter desktop embedding). Here is a simple example on how to use limit the window size of a desktop app:

After applying the above code example, it was all fixed!!! Whew!!!!..
And now, I have a functional and beautiful page.
Alt Text
And that’s all for now. I will share the progress of the desktop application I’m developing in due time ⏰. And if you need any clarifications on this topic, do well to reach out to me on twitter @_iamEtornam.

Akpẽ Kaka (Thank you in EʋE)

originally posted on medium.com


Editor guide
xyn profile image

Hey, thanks for the post! I'm gonna guess you decided to use flutter to make your desktop app because you are a mobile app dev and probably has experience with flutter for mobile but if not I'd like to know how mature Flutter for desktop is compared to Electron?

Maturity can be thought of as features, how good the docs are, production readiness, ecosystem, performance and dev time for now

_regnex profile image
Etornam🤴🏽🇬🇭 Author

Flutter Desktop is still in Alpha release for now. Most plugins developed by the flutter team has desktop support and a number of other community plugins and libraries also have desktop support. With maturity in terms of production readiness, i will say Flutter isn't production ready although some people use it in small production apps but with docs, ecosystem, performance and dev time, since Flutter desktop is basically Flutter itself, the same docs, performance and dev time attributes are the same. with ecosystem, it is still growing as Flutter itself grows.

You can get more information on Flutter desktop here: flutter.dev/desktop