FlutterView class

A view into which a Flutter Scene is drawn.

Each FlutterView has its own layer tree that is rendered whenever render is called on it with a Scene.

References to FlutterView objects are obtained via the PlatformDispatcher.

Insets and Padding

In this illustration, the black areas represent system UI that the app cannot draw over. The red area represents view padding that the view may not be able to detect gestures in and may not want to draw in. The grey area represents the system keyboard, which can cover over the bottom view padding when visible.

The viewInsets are the physical pixels which the operating system reserves for system UI, such as the keyboard, which would fully obscure any content drawn in that area.

The viewPadding are the physical pixels on each side of the display that may be partially obscured by system UI or by physical intrusions into the display, such as an overscan region on a television or a "notch" on a phone. Unlike the insets, these areas may have portions that show the user view-painted pixels without being obscured, such as a notch at the top of a phone that covers only a subset of the area. Insets, on the other hand, either partially or fully obscure the window, such as an opaque keyboard or a partially translucent status bar, which cover an area without gaps.

The padding property is computed from both viewInsets and viewPadding. It will allow a view inset to consume view padding where appropriate, such as when a phone's keyboard is covering the bottom view padding and so "absorbs" it.

Clients that want to position elements relative to the view padding regardless of the view insets should use the viewPadding property, e.g. if you wish to draw a widget at the center of the screen with respect to the iPhone "safe area" regardless of whether the keyboard is showing.

padding is useful for clients that want to know how much padding should be accounted for without concern for the current inset(s) state, e.g. determining whether a gesture should be considered for scrolling purposes. This value varies based on the current state of the insets. For example, a visible keyboard will consume all gestures in the bottom part of the viewPadding anyway, so there is no need to account for that in the padding, which is always safe to use for such calculations.

Implementers

Properties

devicePixelRatio double
The number of device pixels for each logical pixel for the screen this view is displayed on.
no setter
display Display
The Display this view is drawn in.
no setter
displayFeatures List<DisplayFeature>
Areas of the display that are obstructed by hardware features.
no setter
gestureSettings GestureSettings
Additional configuration for touch gestures performed on this view.
no setter
hashCode int
The hash code for this object.
no setterinherited
padding ViewPadding
The number of physical pixels on each side of the display rectangle into which the view can render, but which may be partially obscured by system UI (such as the system notification area), or physical intrusions in the display (e.g. overscan regions on television screens or phone sensor housings).
no setter
physicalConstraints ViewConstraints
The sizing constraints in physical pixels for this view.
no setter
physicalSize Size
The current dimensions of the rectangle as last reported by the platform into which scenes rendered in this view are drawn.
no setter
platformDispatcher PlatformDispatcher
The platform dispatcher that this view is registered with, and gets its information from.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
systemGestureInsets ViewPadding
The number of physical pixels on each side of the display rectangle into which the view can render, but where the operating system will consume input gestures for the sake of system navigation.
no setter
viewId int
The opaque ID for this view.
final
viewInsets ViewPadding
The number of physical pixels on each side of the display rectangle into which the view can render, but over which the operating system will likely place system UI, such as the keyboard, that fully obscures any content.
no setter
viewPadding ViewPadding
The number of physical pixels on each side of the display rectangle into which the view can render, but which may be partially obscured by system UI (such as the system notification area), or physical intrusions in the display (e.g. overscan regions on television screens or phone sensor housings).
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(Scene scene, {Size? size}) → void
Updates the view's rendering on the GPU with the newly provided Scene.
toString() String
A string representation of this object.
override
updateSemantics(SemanticsUpdate update) → void
Change the retained semantics data about this FlutterView.

Operators

operator ==(Object other) bool
The equality operator.
inherited