getWidth static method

double getWidth(
  1. double pixels
)

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;
}