1

I'm developing responsive flutter web application. I want my application to be suggested only in portrait orientation, since I did not consider the landscape mode for the application. Is there any way to lock screen orientation for the flutter web application?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Whao Liang
  • 39
  • 3

1 Answers1

0

You can use MediaQuery.of(context).orientation with RotatedBox to artificially lock it.
By that I mean to use orientation switch in build method and conditionally rotate content to always have correct aspect ratio. You use RotatedBox on highest level to rotate the whole thing

Widget build(BuildContext context) {
    return RotatedBox(...)
}