Migrate bootstrapping in element embedding sample (#2315)

Migrating the Angular sample is blocked on
https://github.com/flutter/flutter/issues/149443

Contributes to https://github.com/flutter/samples/issues/2297.
pull/2319/head
Parker Lougheed 5 months ago committed by GitHub
parent 121d29627a
commit 2b451d2dae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7,7 +7,6 @@ environment:
sdk: ^3.4.0-0 sdk: ^3.4.0-0
dependencies: dependencies:
cupertino_icons: ^1.0.2
flutter: flutter:
sdk: flutter sdk: flutter

@ -162,7 +162,7 @@ h1 {
} }
#flutter_target.resize { #flutter_target.resize {
width: 480px; width: 480px;
height: 320px; height: 336px;
} }
#flutter_target.spin { animation: spin 6400ms ease-in-out infinite; } #flutter_target.spin { animation: spin 6400ms ease-in-out infinite; }
#flutter_target.shadow { position: relative; } #flutter_target.shadow { position: relative; }

@ -20,9 +20,6 @@
<title>Element embedding</title> <title>Element embedding</title>
<link rel="manifest" href="manifest.json" /> <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" /> <link rel="stylesheet" type="text/css" href="css/style.css" />
</head> </head>
<body> <body>
@ -81,17 +78,17 @@
</section> </section>
<script> <script>
window.addEventListener("load", function (ev) { {{flutter_js}}
// Embed flutter into div#flutter_target {{flutter_build_config}}
let target = document.querySelector("#flutter_target");
_flutter.loader.loadEntrypoint({ const target = document.getElementById('flutter_target');
onEntrypointLoaded: async function (engineInitializer) { _flutter.loader.load({
let appRunner = await engineInitializer.initializeEngine({ onEntrypointLoaded: async function (engineInitializer) {
hostElement: target, const appRunner = await engineInitializer.initializeEngine({
}); hostElement: target,
await appRunner.runApp(); });
}, await appRunner.runApp();
}); }
}); });
</script> </script>
<script src="js/demo-js-interop.js" defer></script> <script src="js/demo-js-interop.js" defer></script>

Loading…
Cancel
Save