getOrientation static method

Orientation getOrientation(
  1. BuildContext context
)

Orientation 设备方向(portrait, landscape)

Implementation

static Orientation getOrientation(BuildContext context) {
  MediaQueryData mediaQuery = MediaQuery.of(context);
  return mediaQuery.orientation;
}