getScreenDensity static method

double getScreenDensity(
  1. BuildContext context
)

screen density 当前屏幕 像素密度

Implementation

static double getScreenDensity(BuildContext context) {
  MediaQueryData mediaQuery = MediaQuery.of(context);
  return mediaQuery.devicePixelRatio;
}