B Gaurav
0
Q:

flutter lock screen to portrait mode

@override
dispose(){
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.landscapeRight,
    DeviceOrientation.landscapeLeft,
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);
  super.dispose();
}
0

void main() {
// flutter lock screen to portrait mode
  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);
  runApp(MyBudgetApp());
}
0
<manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.orientation_lock_example">    <application ...>        <activity            android:name=".MainActivity"            android:screenOrientation="portrait"            ...            />            ...         </activity>        ...     </application></manifest>
0

New to Communities?

Join the community