flutterdartscreen-size

How to Determine Screen Height and Width


I've created a new application on Flutter, and I've had problems with the screen sizes when switching between different devices.

I created the application using the Pixel 2XL screen size, and because I've had containers with a child of ListView it's asked me to include a height and width for the container.

So when I switch the device to a new device the container is too long and throws an error.

How can I go about making it so the application is optimized for all screens?


Solution

  • You can use:

    To get height just of SafeArea (for iOS 11 and above):