screen method

void screen(
  1. ScreenOrientation orientation
)

强制竖屏 orientation当前屏幕方向

Implementation

void screen(ScreenOrientation orientation) {
  if (orientation == ScreenOrientation.landscape) {
    SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
  } else if (orientation == ScreenOrientation.portrait) {
    SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
  }
}