Skip to content

Commit

Permalink
Migrate bootstrapping in element embedding sample (#2315)
Browse files Browse the repository at this point in the history
Migrating the Angular sample is blocked on
flutter/flutter#149443

Contributes to #2297.
  • Loading branch information
parlough committed Jun 3, 2024
1 parent 121d296 commit 2b451d2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
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;
}
#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.

0 comments on commit 2b451d2

Please sign in to comment.