<p>You can do this by adding the following code to your main function.background-color: rgb(18, 32, 47);](</p> <p>Now import the services.dart package using the below code.</p> <p>This should do the trick.</p> <p>You can try landscaperight, portraitDown or portraitUp.</p> <p>Here is the complete code for the example.</p> <p id="4ec9b0;](MyApp());" color:="" color:="" color:="" color:=>color: #9cdcfe;](args) </p> <p id="9cdcfe;](key" color:= color:=>color: #569cd6;](class color: #4ec9b0;](MyApp color: #569cd6;](extends color: #4ec9b0;](StatelessWidget ); color: #9cdcfe;](@ color: #9cdcfe;](override</p> <p>color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext color: #9cdcfe;](context) { color: #c586c0;](return color: #569cd6;](const color: #4ec9b0;](MaterialApp( color: #9cdcfe;](home: color: #4ec9b0;](Scaffold( color: #9cdcfe;](body: color: #4ec9b0;](MyContainer(), ), ); } }</p> <p id="9cdcfe;](key," color:= color:="" color:="">color: #569cd6;](class color: #4ec9b0;](MyContainer color: #569cd6;](extends color: #4ec9b0;](StatelessWidget ); color: #9cdcfe;](@ color: #9cdcfe;](override</p> <p>color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext color: #9cdcfe;](context) { color: #569cd6;](var color: #9cdcfe;](screenOrientation = color: #4ec9b0;](MediaQuery.color: #dcdcaa;](of(color: #9cdcfe;](context).color: #9cdcfe;](orientation; color: #c586c0;](return color: #4ec9b0;](Center( color: #9cdcfe;](child: color: #4ec9b0;](Padding( color: #9cdcfe;](padding: color: #569cd6;](const color: #4ec9b0;](EdgeInsets.color: #dcdcaa;](symmetric(color: #9cdcfe;](vertical: color: #b5cea8;](100), color: #9cdcfe;](child: color: #4ec9b0;](Padding( color: #9cdcfe;](padding: color: #569cd6;](const color: #4ec9b0;](EdgeInsets.color: #dcdcaa;](all(color: #b5cea8;](28.0), color: #9cdcfe;](child: color: #4ec9b0;](Column( color: #9cdcfe;](crossAxisAlignment: color: #4ec9b0;](CrossAxisAlignment.color: #4fc1ff;](start, color: #9cdcfe;](children: [ color: #569cd6;](const color: #4ec9b0;](SizedBox( color: #9cdcfe;](height: color: #b5cea8;](20, ), color: #4ec9b0;](Text( color: #ce9178;]('Screen Orientation - $color: #9cdcfe;](screenOrientation color: #ce9178;](', color: #9cdcfe;](style: color: #569cd6;](const color: #4ec9b0;](TextStyle(color: #9cdcfe;](fontSize: color: #b5cea8;](18.0), ), ], ), ), ), ); } } ` Thanks,Srikanth</p>
How to change screen orientation in flutter?
This Article is posted by seven.srikanth at 11/14/2022 4:50:19 PM
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter
Tags: screen orientation in flutter
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter