Skip to content
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

[WIP]: feat: support creating multiple widget adapter from one DOM elements. #687

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

andycall
Copy link
Member

In earlier versions of WebF, an HTMLElement could only have one adapter in the Flutter widget system at a time. When a new widget adapter was created for an HTMLElement, the previously created adapter's RenderObjects would be removed and disposed of.

For certain use cases, such as ContextMenu Flutter widgets, multiple widgets were required to function properly, which conflicted with the initial design of our adapter system.

In this PR, we introduce a new adapter system that creates separate RenderObjects for each widget while sharing the same RenderStyle and DOM element instance.

This means that if we apply styles or add new DOM nodes to the HTMLElement associated with multiple adapters, all the RenderObjects created by these adapters will be updated, resulting in consistent rendering. Additionally, when one of these adapters handles a new event, the event callbacks on the DOM element will be triggered accordingly.

image

@andycall andycall changed the title feat: support creating multiple widget adapter from one DOM elements. [WIP]: feat: support creating multiple widget adapter from one DOM elements. Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants