Flutter change screen orientations

Screen orientation is one of best part in app. Some games always be landscape and some of business based app always be portrait orientation. 


For Portrait orientation:

WidgetsFlutterBinding.ensureInitialized(); 

  await SystemChrome.setPreferredOrientations(

    [DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]);


For Landscape orientation:

WidgetsFlutterBinding.ensureInitialized(); 

  await SystemChrome.setPreferredOrientations(

    [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);


Comments

Popular posts from this blog

Mastering API Development: Why Postman Reigns Supreme Over Swagger

Email Address Validation

Flutter web view