Flutter强制竖屏代码



  • import 'package:flutter/services.dart';
    
    void main() {
      // 强制竖屏
      SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
          .then((_) {
        runApp(MainApp());
      });
    }
    

Log in to reply