|
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="A new Flutter project."> |
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="example"> |
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>example</title> |
33 |
| - <link rel="manifest" href="manifest.json"> |
34 |
| -</head> |
35 |
| -<body> |
36 |
| - <!-- This script installs service_worker.js to provide PWA functionality to |
| 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="A new Flutter project." /> |
| 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="example" /> |
| 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>flutter Tree Example</title> |
| 33 | + <link rel="manifest" href="manifest.json" /> |
| 34 | + <style type="text/css"> |
| 35 | + html, |
| 36 | + body { |
| 37 | + height: 100%; |
| 38 | + width: 100%; |
| 39 | + } |
| 40 | + .center { |
| 41 | + align-items: center; |
| 42 | + display: flex; |
| 43 | + justify-content: center; |
| 44 | + height: 100%; |
| 45 | + width: 100%; |
| 46 | + } |
| 47 | + |
| 48 | + /* Credits: https://tobiasahlin.com/spinkit/ */ |
| 49 | + |
| 50 | + .sk-chase { |
| 51 | + width: 40px; |
| 52 | + height: 40px; |
| 53 | + position: relative; |
| 54 | + left: 0; |
| 55 | + right: 0; |
| 56 | + top: 0; |
| 57 | + bottom: 0; |
| 58 | + animation: sk-chase 2.5s infinite linear both; |
| 59 | + } |
| 60 | + |
| 61 | + .sk-chase-dot { |
| 62 | + width: 100%; |
| 63 | + height: 100%; |
| 64 | + position: absolute; |
| 65 | + left: 0; |
| 66 | + top: 0; |
| 67 | + animation: sk-chase-dot 2s infinite ease-in-out both; |
| 68 | + } |
| 69 | + |
| 70 | + .sk-chase-dot:before { |
| 71 | + content: ""; |
| 72 | + display: block; |
| 73 | + width: 25%; |
| 74 | + height: 25%; |
| 75 | + border-radius: 100%; |
| 76 | + background-color: #1389fd; |
| 77 | + animation: sk-chase-dot-before 2s infinite ease-in-out both; |
| 78 | + } |
| 79 | + |
| 80 | + .sk-chase-dot:nth-child(1) { |
| 81 | + animation-delay: -1.1s; |
| 82 | + } |
| 83 | + |
| 84 | + .sk-chase-dot:nth-child(2) { |
| 85 | + animation-delay: -1s; |
| 86 | + } |
| 87 | + |
| 88 | + .sk-chase-dot:nth-child(3) { |
| 89 | + animation-delay: -0.9s; |
| 90 | + } |
| 91 | + |
| 92 | + .sk-chase-dot:nth-child(4) { |
| 93 | + animation-delay: -0.8s; |
| 94 | + } |
| 95 | + |
| 96 | + .sk-chase-dot:nth-child(5) { |
| 97 | + animation-delay: -0.7s; |
| 98 | + } |
| 99 | + |
| 100 | + .sk-chase-dot:nth-child(6) { |
| 101 | + animation-delay: -0.6s; |
| 102 | + } |
| 103 | + |
| 104 | + .sk-chase-dot:nth-child(1):before { |
| 105 | + animation-delay: -1.1s; |
| 106 | + } |
| 107 | + |
| 108 | + .sk-chase-dot:nth-child(2):before { |
| 109 | + animation-delay: -1s; |
| 110 | + } |
| 111 | + |
| 112 | + .sk-chase-dot:nth-child(3):before { |
| 113 | + animation-delay: -0.9s; |
| 114 | + } |
| 115 | + |
| 116 | + .sk-chase-dot:nth-child(4):before { |
| 117 | + animation-delay: -0.8s; |
| 118 | + } |
| 119 | + |
| 120 | + .sk-chase-dot:nth-child(5):before { |
| 121 | + animation-delay: -0.7s; |
| 122 | + } |
| 123 | + |
| 124 | + .sk-chase-dot:nth-child(6):before { |
| 125 | + animation-delay: -0.6s; |
| 126 | + } |
| 127 | + |
| 128 | + @keyframes sk-chase { |
| 129 | + 100% { |
| 130 | + transform: rotate(360deg); |
| 131 | + } |
| 132 | + } |
| 133 | + |
| 134 | + @keyframes sk-chase-dot { |
| 135 | + 80%, |
| 136 | + 100% { |
| 137 | + transform: rotate(360deg); |
| 138 | + } |
| 139 | + } |
| 140 | + |
| 141 | + @keyframes sk-chase-dot-before { |
| 142 | + 50% { |
| 143 | + transform: scale(0.4); |
| 144 | + } |
| 145 | + 100%, |
| 146 | + 0% { |
| 147 | + transform: scale(1); |
| 148 | + } |
| 149 | + } |
| 150 | + </style> |
| 151 | + </head> |
| 152 | + <body> |
| 153 | + <div class="center" id="loading"> |
| 154 | + <div class="sk-chase"> |
| 155 | + <div class="sk-chase-dot"></div> |
| 156 | + <div class="sk-chase-dot"></div> |
| 157 | + <div class="sk-chase-dot"></div> |
| 158 | + <div class="sk-chase-dot"></div> |
| 159 | + <div class="sk-chase-dot"></div> |
| 160 | + <div class="sk-chase-dot"></div> |
| 161 | + </div> |
| 162 | + </div> |
| 163 | + <!-- This script installs service_worker.js to provide PWA functionality to |
37 | 164 | application. For more information, see:
|
38 | 165 | https://developers.google.com/web/fundamentals/primers/service-workers -->
|
39 |
| - <script> |
40 |
| - var serviceWorkerVersion = null; |
41 |
| - var scriptLoaded = false; |
42 |
| - function loadMainDartJs() { |
43 |
| - if (scriptLoaded) { |
44 |
| - return; |
45 |
| - } |
46 |
| - scriptLoaded = true; |
47 |
| - var scriptTag = document.createElement('script'); |
48 |
| - scriptTag.src = 'main.dart.js'; |
49 |
| - scriptTag.type = 'application/javascript'; |
50 |
| - document.body.append(scriptTag); |
51 |
| - } |
52 |
| - |
53 |
| - if ('serviceWorker' in navigator) { |
54 |
| - // Service workers are supported. Use them. |
55 |
| - window.addEventListener('load', function () { |
56 |
| - // Wait for registration to finish before dropping the <script> tag. |
57 |
| - // Otherwise, the browser will load the script multiple times, |
58 |
| - // potentially different versions. |
59 |
| - var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion; |
60 |
| - navigator.serviceWorker.register(serviceWorkerUrl) |
61 |
| - .then((reg) => { |
| 166 | + <script> |
| 167 | + var serviceWorkerVersion = null; |
| 168 | + var scriptLoaded = false; |
| 169 | + function loadMainDartJs() { |
| 170 | + if (scriptLoaded) { |
| 171 | + return; |
| 172 | + } |
| 173 | + scriptLoaded = true; |
| 174 | + var scriptTag = document.createElement("script"); |
| 175 | + scriptTag.src = "main.dart.js"; |
| 176 | + scriptTag.type = "application/javascript"; |
| 177 | + document.body.append(scriptTag); |
| 178 | + } |
| 179 | + |
| 180 | + if ("serviceWorker" in navigator) { |
| 181 | + // Service workers are supported. Use them. |
| 182 | + window.addEventListener("load", function () { |
| 183 | + // Wait for registration to finish before dropping the <script> tag. |
| 184 | + // Otherwise, the browser will load the script multiple times, |
| 185 | + // potentially different versions. |
| 186 | + var serviceWorkerUrl = |
| 187 | + "flutter_service_worker.js?v=" + serviceWorkerVersion; |
| 188 | + navigator.serviceWorker.register(serviceWorkerUrl).then((reg) => { |
62 | 189 | function waitForActivation(serviceWorker) {
|
63 |
| - serviceWorker.addEventListener('statechange', () => { |
64 |
| - if (serviceWorker.state == 'activated') { |
65 |
| - console.log('Installed new service worker.'); |
| 190 | + serviceWorker.addEventListener("statechange", () => { |
| 191 | + if (serviceWorker.state == "activated") { |
| 192 | + console.log("Installed new service worker."); |
66 | 193 | loadMainDartJs();
|
67 | 194 | }
|
68 | 195 | });
|
|
74 | 201 | } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
|
75 | 202 | // When the app updates the serviceWorkerVersion changes, so we
|
76 | 203 | // need to ask the service worker to update.
|
77 |
| - console.log('New service worker available.'); |
| 204 | + console.log("New service worker available."); |
78 | 205 | reg.update();
|
79 | 206 | waitForActivation(reg.installing);
|
80 | 207 | } else {
|
81 | 208 | // Existing service worker is still good.
|
82 |
| - console.log('Loading app from service worker.'); |
| 209 | + console.log("Loading app from service worker."); |
83 | 210 | loadMainDartJs();
|
84 | 211 | }
|
85 | 212 | });
|
86 | 213 |
|
87 |
| - // If service worker doesn't succeed in a reasonable amount of time, |
88 |
| - // fallback to plaint <script> tag. |
89 |
| - setTimeout(() => { |
90 |
| - if (!scriptLoaded) { |
91 |
| - console.warn( |
92 |
| - 'Failed to load app from service worker. Falling back to plain <script> tag.', |
93 |
| - ); |
94 |
| - loadMainDartJs(); |
95 |
| - } |
96 |
| - }, 4000); |
| 214 | + // If service worker doesn't succeed in a reasonable amount of time, |
| 215 | + // fallback to plaint <script> tag. |
| 216 | + setTimeout(() => { |
| 217 | + if (!scriptLoaded) { |
| 218 | + console.warn( |
| 219 | + "Failed to load app from service worker. Falling back to plain <script> tag." |
| 220 | + ); |
| 221 | + loadMainDartJs(); |
| 222 | + } |
| 223 | + }, 4000); |
| 224 | + }); |
| 225 | + } else { |
| 226 | + // Service workers not supported. Just drop the <script> tag. |
| 227 | + loadMainDartJs(); |
| 228 | + } |
| 229 | + |
| 230 | + window.addEventListener("flutter-first-frame", function () { |
| 231 | + console.log("flutter app loaded."); |
| 232 | + document.getElementById("loading").remove(); |
97 | 233 | });
|
98 |
| - } else { |
99 |
| - // Service workers not supported. Just drop the <script> tag. |
100 |
| - loadMainDartJs(); |
101 |
| - } |
102 |
| - </script> |
103 |
| -</body> |
| 234 | + </script> |
| 235 | + </body> |
104 | 236 | </html>
|
0 commit comments