|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html>
|
3 |
| -<head> |
4 |
| - <!-- |
| 3 | + <head> |
| 4 | + <!-- |
5 | 5 | If you are serving your web app in a path other than the root, change the
|
6 | 6 | href value below to reflect the base path you are serving from.
|
7 | 7 |
|
|
14 | 14 | This is a placeholder for base href that will be replaced by the value of
|
15 | 15 | the `--base-href` argument provided to `flutter build`.
|
16 | 16 | -->
|
17 |
| - <base href="$FLUTTER_BASE_HREF"> |
18 |
| - |
19 |
| - <meta charset="UTF-8"> |
20 |
| - <meta content="IE=Edge" http-equiv="X-UA-Compatible"> |
21 |
| - <meta name="description" content="{{{project_description}}}"> |
22 |
| - |
23 |
| - <!-- iOS meta tags & icons --> |
24 |
| - <meta name="apple-mobile-web-app-capable" content="yes"> |
25 |
| - <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
26 |
| - <meta name="apple-mobile-web-app-title" content="{{project_title}}"> |
27 |
| - <link rel="apple-touch-icon" href="icons/Icon-192.png"> |
28 |
| - |
29 |
| - <!-- Favicon --> |
30 |
| - <link rel="icon" type="image/png" href="favicon.png"/> |
31 |
| - |
32 |
| - <title>{{project_title}}</title> |
33 |
| - <link rel="manifest" href="manifest.json"> |
34 |
| - <style type="text/css"> |
35 |
| - body.loading-mode { |
36 |
| - display: flex; |
37 |
| - align-items: center; |
38 |
| - justify-content: center; |
39 |
| - } |
40 |
| - </style> |
41 |
| - |
42 |
| - <script> |
43 |
| - // The value below is injected by flutter build, do not touch. |
44 |
| - var serviceWorkerVersion = null; |
45 |
| - </script> |
46 |
| -</head> |
47 |
| -<body class="loading-mode"> |
48 |
| - <div id="progress-bar" style="border: 1px solid blue; width: 250px; height: 50px;"> |
49 |
| - <div id="progress-indicator" style="background-color: blue; height: 100%; width: 0%;"></div> |
50 |
| - </div> |
51 |
| - <script> |
52 |
| - (function() { |
53 |
| - const progressBar = document.querySelector('#progress-bar'); |
54 |
| - const progressIndicator = document.querySelector('#progress-indicator'); |
55 |
| - |
56 |
| - const additionalScripts = [ |
57 |
| - // Add additional scripts here. |
58 |
| - ]; |
59 |
| - |
60 |
| - function injectScript(url) { |
61 |
| - return new Promise(function(resolve) { |
62 |
| - let scriptTag = document.createElement('script'); |
63 |
| - scriptTag.src = url; |
64 |
| - scriptTag.type = 'application/javascript'; |
65 |
| - scriptTag.onload = function() { |
66 |
| - resolve(); |
67 |
| - }; |
68 |
| - |
69 |
| - document.body.append(scriptTag); |
70 |
| - }); |
| 17 | + <base href="$FLUTTER_BASE_HREF" /> |
| 18 | + |
| 19 | + <meta charset="UTF-8" /> |
| 20 | + <meta content="IE=Edge" http-equiv="X-UA-Compatible" /> |
| 21 | + <meta name="description" content="{{{project_description}}}" /> |
| 22 | + |
| 23 | + <!-- iOS meta tags & icons --> |
| 24 | + <meta name="apple-mobile-web-app-capable" content="yes" /> |
| 25 | + <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
| 26 | + <meta name="apple-mobile-web-app-title" content="{{project_title}}" /> |
| 27 | + <link rel="apple-touch-icon" href="icons/Icon-192.png" /> |
| 28 | + |
| 29 | + <!-- Favicon --> |
| 30 | + <link rel="icon" type="image/png" href="favicon.png" /> |
| 31 | + |
| 32 | + <title>{{project_title}}</title> |
| 33 | + <link rel="manifest" href="manifest.json" /> |
| 34 | + |
| 35 | + <style type="text/css"> |
| 36 | + body { |
| 37 | + display: flex; |
| 38 | + align-items: center; |
| 39 | + justify-content: center; |
| 40 | + height: 100vh; |
71 | 41 | }
|
72 |
| - |
73 |
| - function beginPreloading(manifestAssets) { |
74 |
| - var assets = [ |
75 |
| - 'flutter.js', |
76 |
| - 'main.dart.js', |
77 |
| - {{#canvaskit}} |
78 |
| - 'canvaskit/canvaskit.wasm', |
79 |
| - 'canvaskit/canvaskit.js', |
80 |
| - {{/canvaskit}} |
81 |
| - ...additionalScripts, |
82 |
| - ...manifestAssets, |
83 |
| - ]; |
84 |
| - let totalAssets = assets.length + 1; |
85 |
| - let loaded = 0; |
86 |
| - |
87 |
| - const batchSize = {{batch_size}}; |
88 |
| - |
89 |
| - async function reportProgress() { |
90 |
| - loaded++; |
91 |
| - const value = Math.floor((loaded / totalAssets) * 100) + '%'; |
92 |
| - progressIndicator.style.width = value; |
93 |
| - |
94 |
| - if (assets.length == 0) { |
95 |
| - dispatchAppLoad(); |
96 |
| - } else { |
97 |
| - load(assets.shift()); |
98 |
| - } |
99 |
| - } |
100 |
| - |
101 |
| - function load(url) { |
102 |
| - const req = new XMLHttpRequest(); |
103 |
| - req.onload = reportProgress; |
104 |
| - req.open('get', url); |
105 |
| - req.send(); |
106 |
| - } |
107 |
| - |
108 |
| - function startBatch() { |
109 |
| - const end = Math.min(batchSize, assets.length); |
110 |
| - for (let i = 0; i < end; i++) { |
111 |
| - load(assets.shift()); |
112 |
| - } |
113 |
| - } |
114 |
| - |
115 |
| - |
116 |
| - var scriptLoaded = false; |
117 |
| - async function dispatchAppLoad() { |
118 |
| - if (scriptLoaded) { |
119 |
| - return; |
120 |
| - } |
121 |
| - scriptLoaded = true; |
122 |
| - |
123 |
| - for (let i = 0; i < additionalScripts.length; i++) { |
124 |
| - await injectScript(additionalScripts[i]); |
125 |
| - } |
126 |
| - |
127 |
| - await injectScript('flutter.js'); |
128 |
| - |
129 |
| - // Download main.dart.js |
130 |
| - _flutter.loader.loadEntrypoint({ |
131 |
| - serviceWorker: { |
132 |
| - serviceWorkerVersion: serviceWorkerVersion, |
133 |
| - }, |
134 |
| - onEntrypointLoaded: function(engineInitializer) { |
135 |
| - engineInitializer.initializeEngine().then(async function(appRunner) { |
136 |
| - window.addEventListener("flutter-first-frame", function () { |
137 |
| - progressBar.remove(); |
138 |
| - document.body.classList.remove('loading-mode'); |
139 |
| - }); |
140 |
| - |
141 |
| - appRunner.runApp(); |
142 |
| - }); |
143 |
| - } |
144 |
| - }); |
145 |
| - } |
146 |
| - |
147 |
| - startBatch(); |
148 |
| - } |
149 |
| - |
150 |
| - window.addEventListener('load', async function(ev) { |
151 |
| - const response = await fetch('assets/AssetManifest.json'); |
152 |
| - const manifest = await response.json(); |
153 |
| - const assets = Object.values(manifest) |
154 |
| - .map((list) => list.map((url) => 'assets/' + url)) |
155 |
| - .reduce((arr, curr) => [...arr, ...curr], []); |
156 |
| - |
157 |
| - beginPreloading(assets); |
158 |
| - }); |
159 |
| - })(); |
160 |
| - </script> |
| 42 | + </style> |
| 43 | + </head> |
| 44 | + <body> |
| 45 | + <div> |
| 46 | + <div id="progress-bar" style="border: 1px solid blue; width: 250px; height: 50px;"> |
| 47 | + <div id="progress-indicator" style="background-color: blue; height: 100%; width: 0%;"></div> |
| 48 | + </div> |
| 49 | + <div id="progress-text" width="100%" style="padding-top: 0.5rem; text-align: center;">Initializing</div> |
| 50 | + </div> |
| 51 | + <script src="flutter_bootstrap.js" async></script> |
161 | 52 | </body>
|
162 | 53 | </html>
|
0 commit comments