Skip to content

Add simple web support #18

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

Merged
merged 2 commits into from
Nov 28, 2023
Merged

Conversation

harryterkelsen
Copy link
Contributor

Adds support for web in the multiview playground.

Screenshot 2023-11-27 at 3 14 20 PM

Copy link
Owner

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Amazing! 🎉

appRunner.runApp().then(function(flutterApp) {
flutterApp.addView({hostElement: document.querySelector("#left")});
flutterApp.addView({hostElement: document.querySelector("#right")});
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own understanding: The screenshot in the PR description shows 3 views, this only adds two. Is the screenshot just outdated? Or does the web engine still utilize the implicit view as third view? If its the implicit view, what div is that one rendered into?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The engine always creates an implicit view (which always has id 0). It creates the element which hosts the flutter app dynamically once the app starts. I don't think we currently allow creating an app without creating the implicit view.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. We currently do the same on the other desktop platforms with plans to add a flag to disable the implicit view.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll definitely disable the implicit view when multiViewEnabled: true :P

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implicit view actually covers the two added views (try the widgets_counter.dart example). It just happens to work here because the app is mostly transparent.

Here, disabling the implicit view and making sure things actually run: flutter/engine#48505

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we need this too: #19

@harryterkelsen
Copy link
Contributor Author

FYI this won't work with main Flutter until flutter/flutter#139103 lands

@harryterkelsen
Copy link
Contributor Author

The underlying engine bits have made it into the framework

@goderbauer goderbauer merged commit 6b0f8c6 into goderbauer:main Nov 28, 2023
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.

4 participants