getSudGIPPlatformView function

Widget getSudGIPPlatformView(
  1. dynamic onViewCreated(
    1. int viewId
    )
)

Implementation

Widget getSudGIPPlatformView(Function(int viewId) onViewCreated) {
  String viewType = 'SudGIPPlatformView';
  if (TargetPlatform.iOS == defaultTargetPlatform) {
    return UiKitView(
      key: UniqueKey(),
      viewType: viewType,
      onPlatformViewCreated: (int viewId) {
        onViewCreated(viewId);
      },
    );
  } else if (TargetPlatform.android == defaultTargetPlatform) {
    // Pass parameters to the platform side.
    // const Map<String, dynamic> creationParams = <String, dynamic>{};
    // return PlatformViewLink(
    //   viewType: viewType,
    //   surfaceFactory: (context, controller) {
    //     return AndroidViewSurface(controller: controller as AndroidViewController, gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{}, hitTestBehavior: PlatformViewHitTestBehavior.opaque);
    //   },
    //   onCreatePlatformView: (params) {
    //     return PlatformViewsService.initExpensiveAndroidView(
    //         id: params.id,
    //         viewType: viewType,
    //         layoutDirection: TextDirection.ltr,
    //         creationParams: creationParams,
    //         creationParamsCodec: const StandardMessageCodec(),
    //         onFocus: () {
    //           params.onFocusChanged(true);
    //         },
    //       )
    //       ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
    //       ..create();
    //   },
    // );

    // 使用AndroidView会导致原生的SurfaceView被置于最顶端显示,如果使用pro版SDK,则不能用此View
    return AndroidView(
      key: UniqueKey(),
      viewType: viewType,
      onPlatformViewCreated: (int viewId) {
        onViewCreated(viewId);
      },
    );
  }
  throw UnsupportedError('Unsupported platforms:$defaultTargetPlatform');
}