Class PlatformViewsController

    • Constructor Detail

      • PlatformViewsController

        public PlatformViewsController()
    • Method Detail

      • attach

        public void attach​(@Nullable
                           Context context,
                           @NonNull
                           TextureRegistry textureRegistry,
                           @NonNull
                           DartExecutor dartExecutor)
        Attaches this platform views controller to its input and output channels.
        Parameters:
        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 set up a system channel.
      • setSoftwareRendering

        public void setSoftwareRendering​(boolean useSoftwareRendering)
        Sets whether Flutter uses software rendering.

        When software rendering is used, no GL context is available on the raster thread. When this is set to true, there's no Flutter composition of Android views and Flutter widgets since GL textures cannot be used.

        Software rendering is only used for testing in emulators, and it should never be set to true in a production environment.

        Parameters:
        useSoftwareRendering - Whether software rendering is used.
      • detach

        @UiThread
        public void detach()
        Detaches this platform views controller.

        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.

      • attachToView

        public void attachToView​(@NonNull
                                 FlutterView newFlutterView)
        Attaches the controller to a FlutterView.

        When FlutterFragment is used, this method is called after the device rotates since the FlutterView is recreated after a rotation.

      • detachFromView

        public void detachFromView()
        Detaches the controller from FlutterView.

        When FlutterFragment is used, this method is called when the device rotates since the FlutterView is detached from the fragment. The next time the fragment needs to be displayed, a new Flutter view is created, so attachToView is called again.

      • attachTextInputPlugin

        public void attachTextInputPlugin​(@NonNull
                                          TextInputPlugin textInputPlugin)
        Attaches this controller to a text input plugin.

        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.

      • detachTextInputPlugin

        public void detachTextInputPlugin()
        Detaches this controller from the currently attached text input plugin.
      • checkInputConnectionProxy

        public boolean checkInputConnectionProxy​(@Nullable
                                                 View view)
        Returns true if Flutter should perform input connection proxying for the 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.

      • onPreEngineRestart

        public void onPreEngineRestart()
      • attachToFlutterRenderer

        public void attachToFlutterRenderer​(@NonNull
                                            FlutterRenderer flutterRenderer)
      • onDisplayPlatformView

        public void onDisplayPlatformView​(int viewId,
                                          int x,
                                          int y,
                                          int width,
                                          int height,
                                          int viewWidth,
                                          int viewHeight,
                                          @NonNull
                                          FlutterMutatorsStack mutatorsStack)
        Called when a platform view id displayed in the current frame.
        Parameters:
        viewId - The ID of the platform view.
        x - The left position relative to FlutterView.
        y - The top position relative to FlutterView.
        width - The width of the platform view.
        height - The height of the platform view.
        viewWidth - The original width of the platform view before applying the mutator stack.
        viewHeight - The original height of the platform view before applying the mutator stack.
        mutatorsStack - The mutator stack. This member is not intended for public use, and is only visible for testing.
      • onDisplayOverlaySurface

        public void onDisplayOverlaySurface​(int id,
                                            int x,
                                            int y,
                                            int width,
                                            int height)
        Called when an overlay surface is displayed in the current frame.
        Parameters:
        id - The ID of the surface.
        x - The left position relative to FlutterView.
        y - The top position relative to FlutterView.
        width - The width of the surface.
        height - The height of the surface. This member is not intended for public use, and is only visible for testing.
      • onBeginFrame

        public void onBeginFrame()
      • onEndFrame

        public void onEndFrame()
        Called by FlutterJNI when the Flutter frame was submitted.

        This member is not intended for public use, and is only visible for testing.

      • createOverlaySurface

        @NonNull
        public FlutterOverlaySurface createOverlaySurface​(@NonNull
                                                          FlutterImageView imageView)
        Creates and tracks the overlay surface.
        Parameters:
        imageView - The surface that displays the overlay.
        Returns:
        Wrapper object that provides the layer id and the surface. This member is not intended for public use, and is only visible for testing.
      • createOverlaySurface

        @NonNull
        public FlutterOverlaySurface createOverlaySurface()
        Creates an overlay surface while the Flutter view is rendered by FlutterImageView.

        This method is invoked by FlutterJNI only.

        This member is not intended for public use, and is only visible for testing.

      • destroyOverlaySurfaces

        public void destroyOverlaySurfaces()
        Destroys the overlay surfaces and removes them from the view hierarchy.

        This method is used only internally by FlutterJNI.