Flutter控制屏幕旋转
/// 初始化时设置为只能竖屏
@override void initState() { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown ]); super.initState(); }
/// 退出时还原四个方向
dispose(){ SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); super.dispose(); }