setDeviceData static method
void
setDeviceData(
- BuildContext context,
- BoxConstraints constraints,
- Orientation currentOrientation
Implementation
static void setDeviceData(
BuildContext context,
BoxConstraints constraints,
Orientation currentOrientation,
) {
// Sets boxconstraints and orientation
boxConstraints = constraints;
orientation = currentOrientation;
// Sets screen width and height
width = boxConstraints.maxWidth;
height = boxConstraints.maxHeight;
// set screen type and device type
deviceType = getDeviceType(defaultTargetPlatform);
screenType = getScreenType(MediaQuery.of(context));
// Sets aspect and pixel ratio
aspectRatio = constraints.constrainDimensions(width, height).aspectRatio;
pixelRatio = View.of(context).devicePixelRatio;
}