public class PlatformViewsController extends Object implements PlatformViewsAccessibilityDelegate
Each FlutterPluginRegistry
has a single platform views controller. A
platform views controller can be attached to at most one Flutter view.
Constructor and Description |
---|
PlatformViewsController() |
Modifier and Type | Method and Description |
---|---|
void |
attach(Context context,
TextureRegistry textureRegistry,
DartExecutor dartExecutor)
Attaches this platform views controller to its input and output channels.
|
void |
attachAccessibilityBridge(AccessibilityBridge accessibilityBridge)
Attaches an accessibility bridge for this platform views accessibility delegate.
|
void |
attachTextInputPlugin(TextInputPlugin textInputPlugin)
Attaches this controller to a text input plugin.
|
void |
attachToFlutterRenderer(FlutterRenderer flutterRenderer) |
void |
attachToView(View flutterView)
This
PlatformViewsController and its FlutterEngine is now attached to an
Android View that renders a Flutter UI. |
boolean |
checkInputConnectionProxy(View view)
Returns true if Flutter should perform input connection proxying for the view.
|
FlutterOverlaySurface |
createOverlaySurface() |
FlutterOverlaySurface |
createOverlaySurface(FlutterImageView imageView) |
void |
destroyOverlaySurfaces() |
void |
detach()
Detaches this platform views controller.
|
void |
detachAccessibiltyBridge()
Detaches the current accessibility bridge.
|
void |
detachFromView()
This
PlatformViewController and its FlutterEngine are no longer attached to an
Android View that renders a Flutter UI. |
void |
detachTextInputPlugin()
Detaches this controller from the currently attached text input plugin.
|
View |
getPlatformViewById(Integer id)
Returns the root of the view hierarchy for the platform view with the requested id, or null if
there is no corresponding view.
|
PlatformViewRegistry |
getRegistry() |
void |
onAttachedToJNI()
Invoked when the
FlutterEngine that owns this PlatformViewsController attaches to JNI. |
void |
onBeginFrame() |
void |
onDetachedFromJNI()
Invoked when the
FlutterEngine that owns this PlatformViewsController detaches from JNI. |
void |
onDisplayOverlaySurface(int id,
int x,
int y,
int width,
int height) |
void |
onDisplayPlatformView(int viewId,
int x,
int y,
int width,
int height,
int viewWidth,
int viewHeight,
FlutterMutatorsStack mutatorsStack) |
void |
onEndFrame() |
void |
onPreEngineRestart() |
MotionEvent |
toMotionEvent(float density,
PlatformViewsChannel.PlatformViewTouch touch,
boolean usingVirtualDiplays) |
boolean |
usesVirtualDisplay(Integer id)
Returns true if the platform view uses virtual displays.
|
public MotionEvent toMotionEvent(float density, PlatformViewsChannel.PlatformViewTouch touch, boolean usingVirtualDiplays)
public void attach(Context context, TextureRegistry textureRegistry, @NonNull DartExecutor dartExecutor)
context
- The base context that will be passed to embedded views created by this
controller. This should be the context of the Activity hosting the Flutter application.textureRegistry
- The texture registry which provides the output textures into which the
embedded views will be rendered.dartExecutor
- The dart execution context, which is used to setup a system channel.@UiThread public void detach()
This is typically called when a Flutter applications moves to run in the background, or is destroyed. After calling this the platform views controller will no longer listen to it's previous messenger, and will not maintain references to the texture registry, context, and messenger passed to the previous attach call.
public void attachToView(@NonNull View flutterView)
PlatformViewsController
and its FlutterEngine
is now attached to an
Android View
that renders a Flutter UI.public void detachFromView()
PlatformViewController
and its FlutterEngine
are no longer attached to an
Android View
that renders a Flutter UI.
All platform views controlled by this PlatformViewController
will be detached from
the previously attached View
.
public void attachAccessibilityBridge(AccessibilityBridge accessibilityBridge)
PlatformViewsAccessibilityDelegate
Accessibility events originating in platform views belonging to this delegate will be delegated to this accessibility bridge.
attachAccessibilityBridge
in interface PlatformViewsAccessibilityDelegate
public void detachAccessibiltyBridge()
PlatformViewsAccessibilityDelegate
Any accessibility events sent by platform views belonging to this delegate will be ignored until a new accessibility bridge is attached.
detachAccessibiltyBridge
in interface PlatformViewsAccessibilityDelegate
public void attachTextInputPlugin(TextInputPlugin textInputPlugin)
While a text input plugin is available, the platform views controller interacts with it to facilitate delegation of text input connections to platform views.
A platform views controller should be attached to a text input plugin whenever it is possible for the Flutter framework to receive text input.
public void detachTextInputPlugin()
public boolean checkInputConnectionProxy(@Nullable View view)
If the view is a platform view managed by this platform views controller returns true. Else
if the view was created in a platform view's VD, delegates the decision to the platform view's
View.checkInputConnectionProxy(View)
method. Else returns false.
public PlatformViewRegistry getRegistry()
public void onAttachedToJNI()
FlutterEngine
that owns this PlatformViewsController
attaches to JNI.public void onDetachedFromJNI()
FlutterEngine
that owns this PlatformViewsController
detaches from JNI.public void onPreEngineRestart()
public View getPlatformViewById(Integer id)
PlatformViewsAccessibilityDelegate
getPlatformViewById
in interface PlatformViewsAccessibilityDelegate
public boolean usesVirtualDisplay(Integer id)
PlatformViewsAccessibilityDelegate
usesVirtualDisplay
in interface PlatformViewsAccessibilityDelegate
public void attachToFlutterRenderer(FlutterRenderer flutterRenderer)
public void onDisplayPlatformView(int viewId, int x, int y, int width, int height, int viewWidth, int viewHeight, FlutterMutatorsStack mutatorsStack)
public void onDisplayOverlaySurface(int id, int x, int y, int width, int height)
public void onBeginFrame()
public void onEndFrame()
public FlutterOverlaySurface createOverlaySurface(@NonNull FlutterImageView imageView)
public FlutterOverlaySurface createOverlaySurface()
public void destroyOverlaySurfaces()