颤振中的度量单位是什么 [英] What is unit of measurement in flutter

查看:78
本文介绍了颤振中的度量单位是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与往常一样,我们将dp用于Android,将pt(point)用于ios作为度量单位.

as usual, we use dp for Android and pt(point) for ios as a unit of measurement.

1 pt = 1/72英寸

1 pt = 1/72 inch

1 dp = 1/160英寸

1 dp = 1/160 inch

但是我不知道颤动中的测量单位是什么

But i don't what is unit of measurement in flutter

示例:

SizedBox(高度:16.0)

SizedBox(height: 16.0)

TextStyle(fontSize:23.0)

TextStyle(fontSize: 23.0)

它只是一个双数,多少个dp或pt等于1.0(波动)?如何计算?

It just a double number, how many dp or pt equal to 1.0 (flutter)? How is it calculated?

推荐答案

来自 https://docs.flutter.io/flutter/dart-ui/Window/devicePixelRatio.html :

每个逻辑像素的设备像素数.这个号码可能 不能是二的幂.实际上,它甚至可能不是整数.为了 例如Nexus 6的设备像素比例为3.5.

The number of device pixels for each logical pixel. This number might not be a power of two. Indeed, it might not even be an integer. For example, the Nexus 6 has a device pixel ratio of 3.5.

设备像素也称为物理像素.逻辑像素 也称为与设备无关或与分辨率无关 像素.

Device pixels are also referred to as physical pixels. Logical pixels are also referred to as device-independent or resolution-independent pixels.

根据定义,每厘米大约有38个逻辑像素,或者 物理显示器每英寸约96个逻辑像素.价值 devicePixelRatio返回的结果最终是从 硬件本身,设备驱动程序或存储在其中的硬编码值 操作系统或固件,并且可能不准确,有时可能是由于 很大的利润.

By definition, there are roughly 38 logical pixels per centimeter, or about 96 logical pixels per inch, of the physical display. The value returned by devicePixelRatio is ultimately obtained either from the hardware itself, the device drivers, or a hard-coded value stored in the operating system or firmware, and may be inaccurate, sometimes by a significant margin.

Flutter框架在逻辑像素中运行,因此很少 直接处理此属性所必需的.

The Flutter framework operates in logical pixels, so it is rarely necessary to directly deal with this property.

这篇关于颤振中的度量单位是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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