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

Migrate bootstrapping in element embedding sample #2315

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion web_embedding/element_embedding_demo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ environment:
sdk: ^3.4.0-0

dependencies:
cupertino_icons: ^1.0.2
flutter:
sdk: flutter

Expand Down
2 changes: 1 addition & 1 deletion web_embedding/element_embedding_demo/web/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ h1 {
}
#flutter_target.resize {
width: 480px;
height: 320px;
height: 336px;
parlough marked this conversation as resolved.
Show resolved Hide resolved
}
#flutter_target.spin { animation: spin 6400ms ease-in-out infinite; }
#flutter_target.shadow { position: relative; }
Expand Down
25 changes: 11 additions & 14 deletions web_embedding/element_embedding_demo/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<title>Element embedding</title>
<link rel="manifest" href="manifest.json" />

<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>

<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
Expand Down Expand Up @@ -81,17 +78,17 @@ <h1>Element embedding</h1>
</section>

<script>
window.addEventListener("load", function (ev) {
// Embed flutter into div#flutter_target
let target = document.querySelector("#flutter_target");
_flutter.loader.loadEntrypoint({
onEntrypointLoaded: async function (engineInitializer) {
let appRunner = await engineInitializer.initializeEngine({
hostElement: target,
});
await appRunner.runApp();
},
});
{{flutter_js}}
{{flutter_build_config}}

const target = document.getElementById('flutter_target');
_flutter.loader.load({
onEntrypointLoaded: async function (engineInitializer) {
const appRunner = await engineInitializer.initializeEngine({
hostElement: target,
});
await appRunner.runApp();
}
});
</script>
<script src="js/demo-js-interop.js" defer></script>
Expand Down
Empty file.
Loading