user14823468
user14823468

Reputation: 111

Flutter flutter_inappwebview "onEnterFullscreen"

Flutter flutter_inappwebview rotate to landscape when the user click the fullscreen video. In the documentation flutter_inappwebview says.

when the page load, the phone automatic landscape, and i received this error.

enter image description here

what i want is, when the user click the fullscreen, the video automatic landscape

Upvotes: 1

Views: 2033

Answers (1)

Mou
Mou

Reputation: 2147

The problem is that onEnterFullscreen is waiting for a (InAppViewController) => void but you are assigning the result of AutoOrientation.landscapeAutoMode().

onEnterFullscreen: AutoOrientation.landscapeAutoMode(),

So, that function is evaluated each time that build method is called. That is the reason why you have those two weird behaviors:

  • Landscape automatically on load
  • Exception because types don't match

To solve that, you need to assign the callback in this way:

onEnterFullscreen: (controller) { AutoOrientation.landscapeAutoMode() },

Upvotes: 2

Related Questions