Skip to content

SystemChrome.setPreferredOrientations uses wrong orientation types on Web #88269

@bselwe

Description

@bselwe

Setting the preferred device orientation with SystemChrome.setPreferredOrientations on Web should map:

  • DeviceOrientation.landscapeLeft to landscape-primary orientation lock type (rather than portrait-secondary)
  • DeviceOrientation.portraitDown to portrait-secondary orientation lock type (rather than landscape-primary)

Current device orientation to orientation lock type mapping (here):

switch (deviceOrientation) {
  case 'DeviceOrientation.portraitUp':
    return orientationLockTypePortraitPrimary;
  case 'DeviceOrientation.landscapeLeft':
    return orientationLockTypePortraitSecondary;
  case 'DeviceOrientation.portraitDown':
    return orientationLockTypeLandscapePrimary;
  case 'DeviceOrientation.landscapeRight':
    return orientationLockTypeLandscapeSecondary;
  default:
    return null;
}

Proposed device orientation to orientation lock type mapping:

switch (deviceOrientation) {
  case 'DeviceOrientation.portraitUp':
    return orientationLockTypePortraitPrimary;
  case 'DeviceOrientation.landscapeLeft':
    return orientationLockTypeLandscapePrimary;
  case 'DeviceOrientation.portraitDown':
    return orientationLockTypePortraitSecondary;
  case 'DeviceOrientation.landscapeRight':
    return orientationLockTypeLandscapeSecondary;
  default:
    return null;
}

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: layoutSystemChrome and Framework's Layout Issuesc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions