void main(){ // 强制横屏 SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight ]); runApp(new MyApp()); }
void main(){ // 强制竖屏 SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown ]); runApp(new MyApp()); }
默认是随系统变化横屏竖屏的,能够根据需求按上面的代码进行修改。在mian()方法中进行修改。code