flutter 强制竖屏和横屏
作者:互联网
参考:https://blog.csdn.net/u013185272/article/details/85695630?utm_medium=distribute.pc_relevant.none-task-blog-searchFromBaidu-3.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-searchFromBaidu-3.control
强制横屏:
void main(){ // 强制横屏 SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight ]); runApp(new MyApp()); }
强制竖屏:
void main(){ // 强制竖屏 SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown ]); runApp(new MyApp()); }
以上代码写在main.dart文件中
标签:竖屏,blog,横屏,DeviceOrientation,强制,main,flutter 来源: https://www.cnblogs.com/lude1994/p/14307389.html