Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rotate issue on iOS only #116711

Closed
flutter/engine
#38230
@SwiftyFlow

Description

@SwiftyFlow

I have an app that is by design always limited to DeviceOrientation.portraitUp. We don't allow any other orientations except for one screen, which is used as PDF or Image viewer, I want to allow ONLY this view to rotate freely. It works fine on Android but not on iOS.

I have added this in initState:
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.landscapeRight, DeviceOrientation.landscapeLeft]);

in that case, all good on Android, but no effect on iOS it's like it has only DeviceOrientation.portraitUp

if I do:

if (Platform.isIOS) {
      SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeRight, DeviceOrientation.landscapeLeft]);
    }

That allows landscape rotations but I cannot do portrait...

Any ideas?

Not mentioned but I do do:

void dispose() {
    SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
    super.dispose();
  }

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: layoutSystemChrome and Framework's Layout Issuesengineflutter/engine repository. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions