Flutter Engine
The Flutter Engine
|
Public Member Functions | |
FlutterView (@NonNull Context context) | |
FlutterView (@NonNull Context context, @NonNull RenderMode renderMode) | |
FlutterView (@NonNull Context context, @NonNull TransparencyMode transparencyMode) | |
FlutterView (@NonNull Context context, @NonNull FlutterSurfaceView flutterSurfaceView) | |
FlutterView (@NonNull Context context, @NonNull FlutterTextureView flutterTextureView) | |
FlutterView (@NonNull Context context, @NonNull FlutterImageView flutterImageView) | |
FlutterView (@NonNull Context context, @Nullable AttributeSet attrs) | |
FlutterView ( @NonNull Context context, @NonNull RenderMode renderMode, @NonNull TransparencyMode transparencyMode) | |
boolean | hasRenderedFirstFrame () |
void | addOnFirstFrameRenderedListener (@NonNull FlutterUiDisplayListener listener) |
void | removeOnFirstFrameRenderedListener (@NonNull FlutterUiDisplayListener listener) |
final WindowInsets | onApplyWindowInsets (@NonNull WindowInsets insets) |
InputConnection | onCreateInputConnection (@NonNull EditorInfo outAttrs) |
boolean | checkInputConnectionProxy (View view) |
boolean | dispatchKeyEvent (@NonNull KeyEvent event) |
boolean | onTouchEvent (@NonNull MotionEvent event) |
boolean | onGenericMotionEvent (@NonNull MotionEvent event) |
boolean | onHoverEvent (@NonNull MotionEvent event) |
AccessibilityNodeProvider | getAccessibilityNodeProvider () |
View | findViewByAccessibilityIdTraversal (int accessibilityId) |
PointerIcon | getSystemPointerIcon (int type) |
BinaryMessenger | getBinaryMessenger () |
boolean | onTextInputKeyEvent (@NonNull KeyEvent keyEvent) |
void | redispatch (@NonNull KeyEvent keyEvent) |
void | attachToFlutterEngine (@NonNull FlutterEngine flutterEngine) |
void | detachFromFlutterEngine () |
FlutterImageView | createImageView () |
FlutterImageView | getCurrentImageSurface () |
void | convertToImageView () |
void | revertImageView (@NonNull Runnable onDone) |
void | attachOverlaySurfaceToRender (@NonNull FlutterImageView view) |
boolean | acquireLatestImageViewFrame () |
Public Member Functions inherited from io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate | |
PointerIcon | getSystemPointerIcon (int type) |
void | setPointerIcon (@NonNull PointerIcon icon) |
BinaryMessenger | getBinaryMessenger () |
boolean | onTextInputKeyEvent (@NonNull KeyEvent keyEvent) |
void | redispatch (@NonNull KeyEvent keyEvent) |
Protected Member Functions | |
void | onConfigurationChanged (@NonNull Configuration newConfig) |
void | onSizeChanged (int width, int height, int oldWidth, int oldHeight) |
WindowInfoRepositoryCallbackAdapterWrapper | createWindowInfoRepo () |
void | onAttachedToWindow () |
void | onDetachedFromWindow () |
void | setWindowInfoListenerDisplayFeatures (WindowLayoutInfo layoutInfo) |
Package Attributes | |
RenderSurface | renderSurface |
Displays a Flutter UI on an Android device.
A FlutterView
's UI is painted by a corresponding io.flutter.embedding.engine.FlutterEngine
.
A FlutterView
can operate in 2 different io.flutter.embedding.android.RenderMode
s:
io.flutter.embedding.android.RenderMode#surface
, which paints a Flutter UI to a android.view.SurfaceView
. This mode has the best performance, but a
FlutterView
in this mode cannot be positioned between 2 other Android View
s in the z-index, nor can it be animated/transformed. Unless the special capabilities of a android.graphics.SurfaceTexture
are required, developers should strongly prefer this render mode. io.flutter.embedding.android.RenderMode#texture
, which paints a Flutter UI to a android.graphics.SurfaceTexture
. This mode is not as performant as io.flutter.embedding.android.RenderMode#surface
, but a FlutterView
in this mode can be animated and transformed, as well as positioned in the z-index between 2+ other Android Views
. Unless the special capabilities of a android.graphics.SurfaceTexture
are required, developers should strongly prefer the io.flutter.embedding.android.RenderMode#surface
render mode. See https://source.android.com/devices/graphics/arch-tv#surface_or_texture for more information comparing android.view.SurfaceView
and android.view.TextureView
.
Definition at line 107 of file FlutterView.java.
|
inline |
Constructs a FlutterView
programmatically, without any XML attributes.
FlutterSurfaceView
is used to render the Flutter UI. transparencyMode
defaults to TransparencyMode#opaque
. FlutterView
requires an Activity
instead of a generic Context
to be compatible with PlatformViewsController
.
Definition at line 217 of file FlutterView.java.
|
inline |
Deprecated - use FlutterView(Context, FlutterSurfaceView)
or FlutterView(Context, FlutterTextureView)
or FlutterView(Context, FlutterImageView)
instead.
Definition at line 227 of file FlutterView.java.
|
inline |
Deprecated - use FlutterView(Context, FlutterSurfaceView)
or FlutterView(Context, FlutterTextureView)
instead, and configure the incoming
or
FlutterSurfaceViewFlutterTextureView
for transparency as desired.
Constructs a FlutterView
programmatically, without any XML attributes, uses a FlutterSurfaceView
to render the Flutter UI, and allows selection of a
.
transparencyMode
FlutterView
requires an Activity
instead of a generic Context
to be compatible with PlatformViewsController
.
Definition at line 257 of file FlutterView.java.
|
inline |
Constructs a FlutterView
programmatically, without any XML attributes, uses the given FlutterSurfaceView
to render the Flutter UI, and allows selection of a
.
transparencyMode
FlutterView
requires an Activity
instead of a generic Context
to be compatible with PlatformViewsController
.
Definition at line 272 of file FlutterView.java.
|
inline |
Constructs a FlutterView
programmatically, without any XML attributes, uses the given FlutterTextureView
to render the Flutter UI, and allows selection of a
.
transparencyMode
FlutterView
requires an Activity
instead of a generic Context
to be compatible with PlatformViewsController
.
Definition at line 284 of file FlutterView.java.
|
inline |
Constructs a FlutterView
programmatically, without any XML attributes, uses the given FlutterImageView
to render the Flutter UI.
FlutterView
requires an Activity
instead of a generic Context
to be compatible with PlatformViewsController
.
Definition at line 295 of file FlutterView.java.
|
inline |
Constructs a FlutterView
in an XML-inflation-compliant manner.
FlutterView
requires an Activity
instead of a generic Context
to be compatible with PlatformViewsController
.
Definition at line 306 of file FlutterView.java.
|
inline |
Deprecated - use FlutterView(Context, FlutterSurfaceView)
or FlutterView(Context, FlutterTextureView)
instead, and configure the incoming
or
FlutterSurfaceViewFlutterTextureView
for transparency as desired.
Definition at line 316 of file FlutterView.java.
|
inline |
Definition at line 1347 of file FlutterView.java.
|
inline |
Adds the given listener
to this FlutterView
, to be notified upon Flutter's first rendered frame.
Definition at line 420 of file FlutterView.java.
|
inline |
Definition at line 1341 of file FlutterView.java.
|
inline |
Connects this FlutterView
to the given io.flutter.embedding.engine.FlutterEngine
.
This FlutterView
will begin rendering the UI painted by the given FlutterEngine
. This FlutterView
will also begin forwarding interaction events from this FlutterView
to the given io.flutter.embedding.engine.FlutterEngine
, e.g., user touch events, accessibility events, keyboard events, and others.
See detachFromFlutterEngine()
for information on how to detach from a FlutterEngine
.
Definition at line 1076 of file FlutterView.java.
|
inline |
Allows a View
that is not currently the input connection target to invoke commands on the android.view.inputmethod.InputMethodManager
, which is otherwise disallowed.
Returns true to allow non-input-connection-targets to invoke methods on
, or false to exclusively allow the input connection target to invoke such methods.
InputMethodManager
Definition at line 838 of file FlutterView.java.
|
inline |
Converts the current render surface to a FlutterImageView
if it's not one already. Otherwise, it resizes the FlutterImageView
based on the current view size.
Definition at line 1272 of file FlutterView.java.
|
inline |
Definition at line 1258 of file FlutterView.java.
|
inlineprotected |
Definition at line 487 of file FlutterView.java.
|
inline |
Disconnects this FlutterView
from a previously attached io.flutter.embedding.engine.FlutterEngine
.
This FlutterView
will clear its UI and stop forwarding all events to the previously-attached io.flutter.embedding.engine.FlutterEngine
. This includes touch events, accessibility events, keyboard events, and others.
See attachToFlutterEngine(FlutterEngine)
for information on how to attach a FlutterEngine
.
Definition at line 1188 of file FlutterView.java.
|
inline |
Invoked when a hardware key is pressed or released.
This method is typically invoked in response to the press of a physical keyboard key or a D-pad button. It is generally not invoked when a virtual software keyboard is used, though a software keyboard may choose to invoke this method in some situations.
KeyEvent
s are sent from Android to Flutter. KeyboardManager
may do some additional work with the given KeyEvent
, e.g., combine this keyCode
with the previous keyCode
to generate a unicode combined character.
Definition at line 856 of file FlutterView.java.
|
inline |
Prior to Android Q, it's impossible to add real views as descendants of virtual nodes. This breaks accessibility when an Android view is embedded in a Flutter app.
This method overrides a hidden method in ViewGroup
to workaround this limitation. This solution is derivated from Jetpack Compose, and can be found in the Android source code as well.
This workaround finds the descendant View
that matches the provided accessibility id.
accessibilityId | The view accessibility id. |
Definition at line 960 of file FlutterView.java.
|
inline |
Definition at line 933 of file FlutterView.java.
|
inline |
Returns a BinaryMessenger
to send platform messages with.
Implements io.flutter.embedding.android.KeyboardManager.ViewDelegate.
Definition at line 1048 of file FlutterView.java.
|
inline |
Definition at line 1264 of file FlutterView.java.
|
inline |
Gets a system pointer icon object for the given type
.
If typeis not recognized, returns the default pointer icon.
This is typically implemented by calling android.view.PointerIcon#getSystemIcon
with the context associated with this view.
Implements io.flutter.plugin.mouse.MouseCursorPlugin.MouseCursorViewDelegate.
Definition at line 1040 of file FlutterView.java.
|
inline |
Returns true if an attached io.flutter.embedding.engine.FlutterEngine
has rendered at least 1 frame to this FlutterView
.
Returns false if no io.flutter.embedding.engine.FlutterEngine
is attached.
This flag is specific to a given io.flutter.embedding.engine.FlutterEngine
. The following hypothetical timeline demonstrates how this flag changes over time.
flutterEngineA
is attached to this FlutterView
: returns false flutterEngineA
renders its first frame to this FlutterView
: returns true flutterEngineA
is detached from this FlutterView
: returns false flutterEngineB
is attached to this FlutterView
: returns false flutterEngineB
renders its first frame to this FlutterView
: returns true Definition at line 412 of file FlutterView.java.
|
inline |
Invoked when Android's desired window insets change, i.e., padding.
Flutter does not use a standard View
hierarchy and therefore Flutter is unaware of these insets. Therefore, this method calculates the viewport metrics that Flutter should use and then sends those metrics to Flutter.
This callback is not present in API < 20, which means lower API devices will see the wider than expected padding when the status and navigation bars are hidden.
Definition at line 678 of file FlutterView.java.
|
inlineprotected |
Invoked when this is attached to the window.
We register for androidx.window.layout.WindowInfoTracker
updates.
Definition at line 509 of file FlutterView.java.
|
inlineprotected |
Sends relevant configuration data from Android to Flutter when the Android Configuration
changes.
The Android Configuration
might change as a result of device orientation change, device language change, device text scale factor change, etc.
Definition at line 441 of file FlutterView.java.
|
inline |
Creates an InputConnection
to work with a android.view.inputmethod.InputMethodManager
.
Any View
that can take focus or process text input must implement this method by returning a non-null InputConnection
. Flutter may render one or many focusable and text-input widgets, therefore FlutterView
must support an InputConnection
.
The InputConnection
returned from this method comes from a TextInputPlugin
, which is owned by this FlutterView
. A TextInputPlugin
exists to encapsulate the nuances of input communication, rather than spread that logic throughout this
.
FlutterView
Definition at line 821 of file FlutterView.java.
|
inlineprotected |
Invoked when this is detached from the window.
We unregister from androidx.window.layout.WindowInfoTracker
updates.
Definition at line 525 of file FlutterView.java.
|
inline |
Invoked by Android when a generic motion event occurs, e.g., joystick movement, mouse hover, track pad touches, scroll wheel movements, etc.
Flutter handles all of its own gesture detection and processing, therefore this method forwards all MotionEvent
data from Android to Flutter.
Definition at line 897 of file FlutterView.java.
|
inline |
Invoked by Android when a hover-compliant input system causes a hover event.
An example of hover events is a stylus sitting near an Android screen. As the stylus moves from outside a View
to hover over a View
, or move around within a View
, or moves from over a View
to outside a View
, a corresponding MotionEvent
is reported via this method.
Hover events can be used for accessibility touch exploration and therefore are processed here for accessibility purposes.
Definition at line 916 of file FlutterView.java.
|
inlineprotected |
Invoked when this FlutterView
changes size, including upon initial measure.
The initial measure reports an oldWidth
and oldHeight
of zero.
Flutter cares about the width and height of the view that displays it on the host platform. Therefore, when this method is invoked, the new width and height are communicated to Flutter as the "physical size" of the view that displays Flutter's UI.
Definition at line 469 of file FlutterView.java.
|
inline |
Send a KeyEvent
that is not handled by the keyboard responders to the text input system.
keyEvent | the KeyEvent that should be processed by the text input system. It must not be null. |
Implements io.flutter.embedding.android.KeyboardManager.ViewDelegate.
Definition at line 1053 of file FlutterView.java.
|
inline |
Invoked by Android when a user touch event occurs.
Flutter handles all of its own gesture detection and processing, therefore this method forwards all MotionEvent
data from Android to Flutter.
Definition at line 879 of file FlutterView.java.
|
inline |
Send a KeyEvent
that is not handled by Flutter back to the platform.
Implements io.flutter.embedding.android.KeyboardManager.ViewDelegate.
Definition at line 1058 of file FlutterView.java.
|
inline |
Removes the given listener
, which was previously added with addOnFirstFrameRenderedListener(FlutterUiDisplayListener)
.
Definition at line 428 of file FlutterView.java.
|
inline |
If the surface is rendered by a FlutterImageView
, then calling this method will stop rendering to a FlutterImageView
, and render on the previous surface instead.
onDone | a callback called when Flutter UI is rendered on the previous surface. Use this callback to perform cleanups. For example, destroy overlay surfaces. |
Definition at line 1296 of file FlutterView.java.
|
inlineprotected |
Refresh androidx.window.layout.WindowInfoTracker
and android.view.DisplayCutout
display features. Fold, hinge and cutout areas are populated here.
Definition at line 538 of file FlutterView.java.
|
package |
Definition at line 115 of file FlutterView.java.