getAndroidView method

Widget getAndroidView()

Implementation

Widget getAndroidView() {
  if (hybridComposition) {
    // Hybrid Composition method
    return PlatformViewLink(
      viewType: 'com.airship.flutter/InboxMessageView',
      surfaceFactory:
          (BuildContext context, PlatformViewController controller) {
        return AndroidViewSurface(
          controller: controller as AndroidViewController,
          gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
          hitTestBehavior: PlatformViewHitTestBehavior.opaque,
        );
      },
      onCreatePlatformView: (PlatformViewCreationParams params) {
        return PlatformViewsService.initSurfaceAndroidView(
          id: params.id,
          viewType: 'com.airship.flutter/InboxMessageView',
          layoutDirection: TextDirection.ltr,
          creationParams: <String, Object?>{},
          creationParamsCodec: StandardMessageCodec(),
        )
          ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
          ..addOnPlatformViewCreatedListener(onPlatformViewCreated)
          ..create();
      },
    );
  } else {
    // Display View method
    return AndroidView(
      viewType: 'com.airship.flutter/InboxMessageView',
      onPlatformViewCreated: onPlatformViewCreated,
      creationParamsCodec: const StandardMessageCodec(),
    );
  }
}