屏幕抖动大小 [英] Flutter screen size

查看:111
本文介绍了屏幕抖动大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在flutter上创建了一个新的应用程序,并且在不同设备之间切换时屏幕尺寸出现了问题.

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

我使用Pixel 2XL屏幕尺寸创建了该应用程序,并且因为我有带有ListView子级的容器,所以要求我提供容器的高度和宽度.

I created the application using the Pixel 2XL screen size, and because I've had containers with 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 optimised for all screens?

推荐答案

您可以使用:

  • double width = MediaQuery.of(context).size.width;
  • double height = MediaQuery.of(context).size.height;
  • double width = MediaQuery.of(context).size.width;
  • double height = MediaQuery.of(context).size.height;

这篇关于屏幕抖动大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆