Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed orientation issue when exiting full screen mode #813

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MudasirHussain72
Copy link

This pull request addresses issue #812 .

Problem:
When exiting fullscreen mode in the video player, the app was not returning to portrait orientation as expected.

Solution:
I've implemented a fix that ensures the app returns to portrait orientation after exiting fullscreen mode in the video player.

Additionally, I've tested this fix and verified that it resolves the issue.

Fixes: #812

Comment on lines -61 to -70
@override
void didUpdateWidget(Chewie oldWidget) {
if (oldWidget.controller != widget.controller) {
widget.controller.addListener(listener);
}
super.didUpdateWidget(oldWidget);
if (_isFullScreen != isControllerFullScreen) {
widget.controller._isFullScreen = _isFullScreen;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to remove this, since if you refresh the widget with new properties, then removing this code won't update this StatefulWidget with them.

Comment on lines +558 to +561
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The controller should not be responsible for setting SystemChrome whatsoever.

This should be moved into ChewieState and called before calling this method.

Also, it should not assume that it will fall back to Portrait. Instead, there's an option in the ChewieController called deviceOrientationsAfterFullScreen that it should be set to instead.

Comment on lines -176 to -182
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.manual,
overlays: widget.controller.systemOverlaysAfterFullScreen,
);
SystemChrome.setPreferredOrientations(
widget.controller.deviceOrientationsAfterFullScreen,
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore these lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: App Orientation Does Not Return to Portrait on Exiting Full Screen Mode
2 participants