getScreenDensity static method

double getScreenDensity(
  1. BuildContext context
)

screen density 当前屏幕 像素密度

Implementation

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