StagedViewport class
A screen to render a preview on, as it travels from the host to a harness.
The wire form of the host's CaptureViewport, and the same class at both
ends — the host builds one and encodes it, the harness decodes one and
stages it. Two classes with a JSON contract between them would be two
descriptions of one screen, and this repository has paid for that shape
more than once; one class cannot drift from itself.
It carries numbers rather than a device id on purpose. A viewport is not
always a device: --width/--height override one into a size no phone
has, and the panel's own rectangle is no device at all. The embedder guest
is told the same numbers over its resize message, so what the two backends
are staged with is one vocabulary.
Constructors
- StagedViewport({required double width, required double height, double pixelRatio = 1, double insetTop = 0, double insetRight = 0, double insetBottom = 0, double insetLeft = 0, DevicePlatform? platform, double keyboard = 0, bool keyboardUp = false})
-
const
-
StagedViewport.fromJson(Map<
String, Object?> json) -
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
final
- insetBottom → double
-
final
- insetLeft → double
-
final
- insetRight → double
-
final
- insetTop → double
-
The notch, the island, the gesture bar, in logical pixels — the space
EdgeInsetsandMediaQuery.paddingare written in.final - keyboard → double
-
How tall this screen's software keyboard is once it is up, logical.
final
- keyboardUp → bool
-
Whether to hold one up with nothing focused —
KeyboardMode.up.autoanddownboth arrive as false: a preview that focuses a field raises its own, and that is the framework's business rather than the stage's.final - logicalHeight → double
-
no setter
- logicalWidth → double
-
The screen in logical pixels — what the layout is written against.
no setter
- pixelRatio → double
-
final
- platform → DevicePlatform?
-
What the preview is staged as. Null is a rectangle rather than a
device, which is the panel's own surface and what an entry that named no
device gets: no platform override, so
defaultTargetPlatformstays whatever the harness is really running on.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → double
-
Physical pixels — the size of the image that comes out, which is what
the host's
CaptureViewportrecords and what an address names.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited