The Eternal Protection Good Work Provides

Good work is an eternal blessing. It enhances progression. It shows life what we cherish most, provides protection, and helps us grow. The satisfaction of good work is unparalleled. If one does not…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to Determine Screen Height and Width in Flutter?

You want to have distinct UI layouts for different screen sizes if you’re building an app for both phones and tablets. If the customer prefers a much larger text size or wants to minimize animations, you can find yourself in a similar scenario.

MediaQuery gives you a more complete picture of your device screen size and might provide you more information about user layout preferences.

You may get the width or height of the screen by using MediaQuery with the current context of your widget. MediaQuery returns a high-level view of the current app’s screen size, as well as more comprehensive information about the device and its layout preferences. It’s as simple as invoking MediaQuery.of in the build method to get to it.

Click here to learn more about the MediaQuery class.

If you don’t do this, you may get “No MediaQuery widget found” error. See more details at: ’No MediaQuery widget found’ Error in Flutter.

Wrap your Widget at the root with the MaterialApp() widget, as shown below:

So in this article, we will go through how to determine screen height and width in a Flutter app. This article will help you to make your flutter app responsive. We hope you enjoyed this article.

Add a comment

Related posts:

A Mosquito Wants Chicken Curry

The succulent pieces of hot, flavourful juicy chicken curry awaited me, I was ready with the bread in one hand, almost on the verge of diving into, the awesomeness of the onion and garlic infused…

PUP Surviving the Years of Martial Law

I wish I was able to write down my conversation with Maam T. It was a brief typical chikahan at faculty[this is before the pandemic]. I can’t remember how we end discussing the old building of PUP in…

Yet another Docker post

I previously wrote a post extolling the virtues of DevOps. If you don’t want to read it, here’s a tl;dr: I outlined a few challenges that exist in traditional software deployments, and the approaches…