Skip to content

Commit 935674c

Browse files
committed
refactor(web): reformat index.html and update Flutter loading script
- Reformat HTML structure for better readability - Remove unnecessary script tags for serviceWorkerVersion - Update Flutter loading script with new bootstrap and config variables - Adjust CSS styling for splash screen
1 parent 19b0713 commit 935674c

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

web/index.html

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<!DOCTYPE html><html><head>
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
25
<base href="$FLUTTER_BASE_HREF">
36

47
<meta charset="UTF-8">
@@ -20,10 +23,8 @@
2023

2124

2225
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
23-
<script>
24-
var serviceWorkerVersion = null;
25-
</script>
26-
<script src="flutter.js" defer=""></script>
26+
27+
2728
<style id="splash-screen-style">
2829
html {
2930
height: 100%
@@ -33,7 +34,7 @@
3334
margin: 0;
3435
min-height: 100%;
3536
background-color: #FFFFFF;
36-
background-size: 100% 100%;
37+
background-size: 100% 100%;
3738
}
3839

3940
.center {
@@ -46,19 +47,22 @@
4647
}
4748

4849
.contain {
49-
display:block;
50-
width:100%; height:100%;
50+
display: block;
51+
width: 100%;
52+
height: 100%;
5153
object-fit: contain;
5254
}
5355

5456
.stretch {
55-
display:block;
56-
width:100%; height:100%;
57+
display: block;
58+
width: 100%;
59+
height: 100%;
5760
}
5861

5962
.cover {
60-
display:block;
61-
width:100%; height:100%;
63+
display: block;
64+
width: 100%;
65+
height: 100%;
6266
object-fit: cover;
6367
}
6468

@@ -85,7 +89,7 @@
8589
@media (prefers-color-scheme: dark) {
8690
body {
8791
background-color: #212121;
88-
}
92+
}
8993
}
9094
</style>
9195
<script id="splash-screen-script">
@@ -99,22 +103,26 @@
99103

100104
<body>
101105
<picture id="splash">
102-
<source srcset="splash/img/light-1x.png 1x, splash/img/light-2x.png 2x, splash/img/light-3x.png 3x, splash/img/light-4x.png 4x" media="(prefers-color-scheme: light)">
103-
<source srcset="splash/img/dark-1x.png 1x, splash/img/dark-2x.png 2x, splash/img/dark-3x.png 3x, splash/img/dark-4x.png 4x" media="(prefers-color-scheme: dark)">
104-
<img class="center" aria-hidden="true" src="splash/img/light-1x.png" alt="">
106+
<source
107+
srcset="splash/img/light-1x.png 1x, splash/img/light-2x.png 2x, splash/img/light-3x.png 3x, splash/img/light-4x.png 4x"
108+
media="(prefers-color-scheme: light)">
109+
<source
110+
srcset="splash/img/dark-1x.png 1x, splash/img/dark-2x.png 2x, splash/img/dark-3x.png 3x, splash/img/dark-4x.png 4x"
111+
media="(prefers-color-scheme: dark)">
112+
<img class="center" aria-hidden="true" src="splash/img/light-1x.png" alt="">
105113
</picture>
106-
114+
115+
107116

108117
<div id="splash-container" class="center">
109118
<div class="loader"></div>
110119
</div>
111120
<script>
121+
{ { flutter_bootstrap_js } }
122+
{ { flutter_js } }
123+
{ { flutter_build_config } }
112124
window.addEventListener('load', function (ev) {
113-
// Download main.dart.js
114-
_flutter.loader.loadEntrypoint({
115-
serviceWorker: {
116-
serviceWorkerVersion: serviceWorkerVersion,
117-
},
125+
_flutter.loader.load({
118126
onEntrypointLoaded: function (engineInitializer) {
119127
engineInitializer.initializeEngine().then(function (appRunner) {
120128
appRunner.runApp();
@@ -126,4 +134,6 @@
126134

127135

128136

129-
</body></html>
137+
</body>
138+
139+
</html>

0 commit comments

Comments
 (0)