rotatedToLandscape method

SimulatedDisplayFeature rotatedToLandscape(
  1. double portraitWidth
)

Returns this feature mapped through the 90° portrait → landscape rotation, for a portrait screen portraitWidth logical pixels wide.

A point (x, y) in portrait coordinates maps to (y, portraitWidth - x) in landscape coordinates, so a vertical hinge becomes a horizontal one (and vice versa). Exact inverse of rotatedToPortrait.

Implementation

SimulatedDisplayFeature rotatedToLandscape(double portraitWidth) {
  return SimulatedDisplayFeature(
    bounds: ui.Rect.fromLTRB(
      bounds.top,
      portraitWidth - bounds.right,
      bounds.bottom,
      portraitWidth - bounds.left,
    ),
    type: type,
    state: state,
  );
}