Start a new topic

Flutter 3 support

I would like to use Wikitude Flutter SDK 9.12 in an Flutter 3 app


It seems that the creation of Android view has evolved since Flutter 3.0.0, and the Wikitude plugin appears to be concerned with the issue on https://github.com/flutter/flutter/issues/103630


I made a test with the sample app, and as you can see the camera view is now rendered misplaced and on top on the others with Flutter 3.3.3 whereas it was correct with Flutter 2.10.5


Do you know this issue and do you plan release and SDK with the support of Flutter 3


Thank you.



2 people have this problem
1 Comment

The SDK is unworkable without this fix.


I have managed to make the SDK render correctly but it causes the rest of the application to error

on close. I think there is a resultant memory leak due to this change but I am yet to find it.

 

Changes to:

plugin/augmented_reality_plugin_wikitude/lib/architect_widget.dart

  @override
  Widget build(BuildContext context) {
    if (defaultTargetPlatform == TargetPlatform.android) {
      // return AndroidView(
      //   viewType: 'architectwidget',
      //   layoutDirection: TextDirection.ltr,
      //   onPlatformViewCreated: onPlatformViewCreated,
      //   creationParams: configuration,
      //   creationParamsCodec: const StandardMessageCodec(),
      // );

      return PlatformViewLink(
        viewType: 'architectwidget',
        surfaceFactory: (
          BuildContext context,
          PlatformViewController controller,
        ) {
          return AndroidViewSurface(
            controller: controller as AndroidViewController,
            gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
            hitTestBehavior: PlatformViewHitTestBehavior.opaque,
          );
        },
        onCreatePlatformView: (PlatformViewCreationParams params) {
          controller = // @@@@@@@
              PlatformViewsService.initExpensiveAndroidView(
            // @@@@@@@
            id: params.id,
            viewType: 'architectwidget',
            layoutDirection: TextDirection.ltr,
            creationParams: configuration,
            creationParamsCodec: const StandardMessageCodec(),
          );
          controller.addOnPlatformViewCreatedListener(
            params.onPlatformViewCreated,
          );
          controller.addOnPlatformViewCreatedListener(
            onPlatformViewCreated,
          );
          return controller;
        },
      );
    } else if (defaultTargetPlatform == TargetPlatform.iOS) {
      return UiKitView(
        viewType: 'architectwidget',
        onPlatformViewCreated: onPlatformViewCreated,
        creationParams: configuration,
        creationParamsCodec: const StandardMessageCodec(),
      );
    }

    return new Text('$defaultTargetPlatform is not yet supported by this plugin');
  }

 

dart
Login or Signup to post a comment