getWidth static method
Get the proportionate width as per screen size.
If screen height is 320px
, pixels
is 20px
,
y
= 320 / 20
= 16
,
Return 640 / 16
= 20
.
Implementation
static double getWidth(double pixels) {
return (pixels / width) * width;
}