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(); }

 

转载于:https://www.cnblogs.com/hepeng/p/11629762.html

你可能感兴趣的:(Flutter控制屏幕旋转)