getAdapterSizeCtx static method

double getAdapterSizeCtx(
  1. BuildContext context,
  2. double dp
)

兼容横/纵屏。 获取适配后的尺寸,兼容横/纵屏切换,适应宽,高,字体尺寸。 Get the appropriate size, compatible with horizontal/vertical screen switching, can be used for wide, high, font size adaptation.

Implementation

static double getAdapterSizeCtx(BuildContext context, double dp) {
  Size size = MediaQuery.of(context).size;
  if (size == Size.zero) return dp;
  return getRatioCtx(context) * dp;
}