flutter 强制竖屏
   
void main() {
  SystemChrome.setPreferredOrientations(
          [DeviceOrientation.portraitUp,DeviceOrientation.portraitDown])
      .then((_) {
    runApp(MyApp());
  });
}
    
    
    flutter 强制横屏
   
   void main() {
      SystemChrome.setPreferredOrientations(
               [DeviceOrientation.landscapeLeft,DeviceOrientation.landscapeRight])
          .then((_) {
        runApp(MyApp());
      });
    }
 
版权声明:本文为win7583362原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
