How does Flutter handle orientation change. This will help you to force the Flutter application to remain in Portrait (vertical) mode even if the user is rotating the SmartPhone
1 2 3 4 5 6 7 8 9 | class MyWidget extends StatelessWidget { Widget build(BuildContext context) { final mediaQueryData = MediaQuery.of(context); if (mediaQueryData.orientation == Orientation.landscape) { return const Text('landscape'); } return const Text('portrait!'); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.