Answers for "flutter block rotation"

2

how to stop screen rotation in flutter

class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      SystemChrome.setPreferredOrientations([
        DeviceOrientation.portraitUp,
        DeviceOrientation.portraitDown,
      ]);
      return new MaterialApp(...);
    }
  }
Posted by: Guest on August-09-2020
0

flutter portrait only

// This will works always for lock screen Orientation.
void main() {
  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
    .then((_) {
      runApp(new MyApp());
    });
}
Posted by: Guest on August-14-2020
0

flutter block rotation

class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
    // This vvvv
      SystemChrome.setPreferredOrientations([
        DeviceOrientation.portraitUp,
        DeviceOrientation.portraitDown,
      ]);
    // ^^^^
      return new MaterialApp(...);
    }
  }
Posted by: Guest on February-24-2021

Code answers related to "Dart"

Browse Popular Code Answers by Language