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
[web:multi-view] Devise a public API for multi-view #137377
Labels
P1
High-priority issues at the top of the work list
platform-web
Web applications specifically
team-web
Owned by Web platform team
triaged-web
Triaged by Web platform team
Comments
yjbanov
added
platform-web
Web applications specifically
P1
High-priority issues at the top of the work list
team-web
Owned by Web platform team
triaged-web
Triaged by Web platform team
labels
Oct 26, 2023
8 tasks
auto-submit bot
pushed a commit
to flutter/engine
that referenced
this issue
Nov 15, 2023
This change: * Adds a boolean to `multiViewEnabled`. * Removes unused `canvasKitMaximumSurfaces` value. Part of: flutter/flutter#137377 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
8 tasks
auto-submit bot
pushed a commit
to flutter/engine
that referenced
this issue
Nov 21, 2023
This PR adds: * JS-interop types to expose addView/removeView from the running FlutterApp object on JavaScript. * Also, the options object that can be passed to `addView`. ### Issues: * Fixes: flutter/flutter#137377 ### Info Most interesting files: * `app_bootstrap.dart` -> Adds the implementation for JS add/remove view. * `js_app.dart` -> Adds the js-interop layer for the FlutterApp object, and the configuration type. (Two options: `hostElement` and `initialData`). * `flutter_view_manager.dart` -> An abstraction over the `viewData` map that keeps related things together: viewData, js configuration options, register/unregister methods and a Stream<void> of modification events. The rest of the changes were ""required"" to have a small demo that does anything (currently it lets me "register" views from javascript). I didn't add much in there, because probably it's already being worked on by @mdebbar; just fiddled with the constructor of the EngineFlutterView to create views from JS Config, and added a wrapper around the `viewData` map (`FlutterViewManager`) to prevent direct access to the Map. ## Usage This is how I'm currently initializing my Flutter App, so I can "leak" the `flutterApp` to window and do things asynchronously after flutter loads: ```html <script> window.addEventListener('load', async function(ev) { _flutter.loader.loadEntrypoint({ onEntrypointLoaded: function(engineInitializer) { engineInitializer.initializeEngine({ multiViewEnabled: true, }).then(function(appRunner) { return appRunner.runApp(); }).then(onAppRunning); } }); // Leak flutterApp to window so we can do async things... function onAppRunning(flutterApp) { console.log('Running app', flutterApp); window.flutterApp = flutterApp; } }); </script> ``` This to test: * Go on your JS console and use `flutterApp.addView({})` and see how that returns a Promise for the viewId it just added, * Now do `flutterApp.removeView(0)` (removes the implicitView), and see how everything starts crashing! (as expected) * Get out of this weird state with a hot reload � [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
P1
High-priority issues at the top of the work list
platform-web
Web applications specifically
team-web
Owned by Web platform team
triaged-web
Triaged by Web platform team
Devise a public API for embedding FlutterViews into arbitrary number of elements.
Goals
dart:ui_web
,flutter.js
, or both.Non-goals
The text was updated successfully, but these errors were encountered: