8000 [hcpp] Change hcpp view controller class to just use existing hybrid composition view controller. · Issue #164214 · flutter/flutter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[hcpp] Change hcpp view controller class to just use existing hybrid composition view controller. #164214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jonahwilliams opened this issue Feb 26, 2025 · 2 comments
Assignees
Labels
engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@jonahwilliams
Copy link
Member

We probably don't want to have completely separate constructors? Code should check if supported and use the appropriate runtime controller internally.

@jonahwilliams jonahwilliams added P1 High-priority issues at the top of the work list team-android Owned by Android platform team labels Feb 26, 2025
@gmackall gmackall self-assigned this Feb 27, 2025
@gmackall gmackall added P2 Important issues not at the top of the work list engine flutter/engine repository. See also e: labels. triaged-android Triaged by Android platform team and removed P1 High-priority issues at the top of the work list labels Feb 27, 2025
@jmagman
Copy link
Member
jmagman commented Feb 28, 2025

@jonahwilliams Is the constructor exposed to be used by plugins? Or is this an internal-only constructor and this issue is just tracking DRYing out some duplicated code?

@jonahwilliams
Copy link
Member Author

This was Reid's suggestion from the deep dive sync. Right now the way you declare HC and HC++ mode is slightly different:

HC mode:

   return PlatformViewLink(
      viewType: viewType,
      surfaceFactory: (BuildContext context, PlatformViewController controller) {
        return AndroidViewSurface(
          controller: controller as AndroidViewController,
          gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
          hitTestBehavior: PlatformViewHitTestBehavior.opaque,
        );
      },
      onCreatePlatformView: (PlatformViewCreationParams params) {
        return PlatformViewsService.initExpensiveAndroidView(
            id: params.id,
            viewType: viewType,
            layoutDirection: TextDirection.ltr,
            creationParamsCodec: const StandardMessageCodec(),
          )
          ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
          ..create();
      },
    );

HC++ Mode

   return PlatformViewLink(
      viewType: viewType,
      surfaceFactory: (BuildContext context, PlatformViewController controller) {
        return AndroidViewSurface(
          controller: controller as AndroidViewController,
          gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
          hitTestBehavior: PlatformViewHitTestBehavior.opaque,
        );
      },
      onCreatePlatformView: (PlatformViewCreationParams params) {
        return PlatformViewsService.initHybridAndroidView(
            id: params.id,
            viewType: viewType,
            layoutDirection: TextDirection.ltr,
            creationParamsCodec: const StandardMessageCodec(),
          )
          ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
          ..create();
      },
    );

But on the other hand if you wrap all this in a higher level widget like I suggest in #164215 then it doesn't really matter

@reidbaker reidbaker assigned reidbaker and unassigned gmackall Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
None yet
Development

No branches or pull requests

4 participants
0