问题描述
像往常一样,我们对 Android 使用 dp,对 ios 使用 pt(point) 作为度量单位.
as usual, we use dp for Android and pt(point) for ios as a unit of measurement.
1 磅 = 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)
或
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.
设备像素也称为物理像素.逻辑像素也称为与设备无关或与分辨率无关像素.
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.
这篇关于颤振中的计量单位是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!