import 'package:flutter/services.dart'
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
return new MaterialApp();
}
}
Flutter is a mobile app SDK that allows you to write code once and deploy to both iOS and Android. One of the advantages of Flutter is that it allows you to easily control the look and feel of your app across both platforms.
One thing that can be difficult to control is the device rotation. By default, most devices will rotate the screen when the device is rotated. This can be annoying for users and can cause your app to look broken if not properly handled.
Fortunately, Flutter makes it easy to prevent device rotation. In this article, we'll show you how to quickly add a setting to your app that will disable screen rotation.
0 Comments