smls
0
Q:

lock screen orientation flutter

@override
void initState(){
  super.initState();
  SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeRight,
      DeviceOrientation.landscapeLeft,
  ]);
}
0
@override
dispose(){
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.landscapeRight,
    DeviceOrientation.landscapeLeft,
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);
  super.dispose();
}
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
  import 'package:flutter/material.dart';  import 'package:flutter/services.dart';   Future main() async {    await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);    runApp(new MyApp());  }   class MyApp extends StatelessWidget {    @override      Widget build(BuildContext context) {      return MaterialApp(        title: 'Welcome to Flutter',        home: Scaffold(          appBar: AppBar(            title: Text('Flutter Display Orientation Tutorial'),          ),          body: Center(            child: Text(                "Woolha.com"            )          ),        ),      );    }  }
0

New to Communities?

Join the community