flutter video_player(or chewie) enter full screen on landscape mode like youtube

I need a video player that enters full screen when the device is rotated to landscape mode and back. Just like how the video player in apps like YouTube and Udemy. I am using chewie and there is an open issue about it in https://github.com/brianegan/chewie/issues/15 From that, I found this solution https://gist.github.com/ihrankouski/0a353a8de649b648b3ceff0d8e97f1d7 which has a problem that it won't come back to the normal position on portrait mode.

also, there is a file in the chewie example
https://github.com/brianegan/chewie/blob/master/example/lib/auto_rotate.dart that does this(maybe. I don't know what the code is for) but is not working when I tried. Does this have any problem? If yes then what is the problem?

Is there another library that has this functionality, If yes how can this be done with that library.