-
Notifications
You must be signed in to change notification settings - Fork 12
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <!-- | ||
| If you are serving your web app in a path other than the root, change the | ||
| href value below to reflect the base path you are serving from. | ||
|
|
||
| The path provided below has to start and end with a slash "/" in order for | ||
| it to work correctly. | ||
|
|
||
| For more details: | ||
| * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base | ||
|
|
||
| This is a placeholder for base href that will be replaced by the value of | ||
| the `--base-href` argument provided to `flutter build`. | ||
| --> | ||
| <base href="$FLUTTER_BASE_HREF"> | ||
|
|
||
| <meta charset="UTF-8"> | ||
| <meta content="IE=Edge" http-equiv="X-UA-Compatible"> | ||
| <meta name="description" content="A new Flutter project."> | ||
|
|
||
| <!-- iOS meta tags & icons --> | ||
| <meta name="apple-mobile-web-app-capable" content="yes"> | ||
| <meta name="apple-mobile-web-app-status-bar-style" content="black"> | ||
| <meta name="apple-mobile-web-app-title" content="multiview_sample"> | ||
| <link rel="apple-touch-icon" href="icons/Icon-192.png"> | ||
|
|
||
| <!-- Favicon --> | ||
| <link rel="icon" type="image/png" href="favicon.png"/> | ||
|
|
||
| <title>multiview_sample</title> | ||
| <link rel="manifest" href="manifest.json"> | ||
|
|
||
| <script> | ||
| // The value below is injected by flutter build, do not touch. | ||
| const serviceWorkerVersion = null; | ||
| </script> | ||
| <!-- This script adds the flutter initialization JS code --> | ||
| <script src="flutter.js" defer></script> | ||
| </head> | ||
| <body> | ||
| <div style="width: 100%; height: 100%;"> | ||
| <div id="left" style="width: 50%; height: 100%; float: left;"></div> | ||
| <div id="right" style="width: 50%; height: 100%; float: left;"></div> | ||
| </div> | ||
| <script> | ||
| window.addEventListener('load', function(ev) { | ||
| // Download main.dart.js | ||
| _flutter.loader.loadEntrypoint({ | ||
| serviceWorker: { | ||
| serviceWorkerVersion: serviceWorkerVersion, | ||
| }, | ||
| onEntrypointLoaded: function(engineInitializer) { | ||
| engineInitializer.initializeEngine({ | ||
| multiViewEnabled: true, | ||
| }).then(function(appRunner) { | ||
| appRunner.runApp().then(function(flutterApp) { | ||
| flutterApp.addView({hostElement: document.querySelector("#left")}); | ||
| flutterApp.addView({hostElement: document.querySelector("#right")}); | ||
| }); | ||
| }); | ||
| } | ||
| }); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "name": "multiview_sample", | ||
| "short_name": "multiview_sample", | ||
| "start_url": ".", | ||
| "display": "standalone", | ||
| "background_color": "#0175C2", | ||
| "theme_color": "#0175C2", | ||
| "description": "A new Flutter project.", | ||
| "orientation": "portrait-primary", | ||
| "prefer_related_applications": false, | ||
| "icons": [ | ||
| { | ||
| "src": "icons/Icon-192.png", | ||
| "sizes": "192x192", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "icons/Icon-512.png", | ||
| "sizes": "512x512", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "icons/Icon-maskable-192.png", | ||
| "sizes": "192x192", | ||
| "type": "image/png", | ||
| "purpose": "maskable" | ||
| }, | ||
| { | ||
| "src": "icons/Icon-maskable-512.png", | ||
| "sizes": "512x512", | ||
| "type": "image/png", | ||
| "purpose": "maskable" | ||
| } | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:PThere was a problem hiding this comment.
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.dartexample). 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
There was a problem hiding this comment.
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