目前我正在展示一個加載器,當顫動的網開始初始化的時候。
索引:
<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
The path provided below has to start and end with a slash "/" in order for
it to work correctly.
For more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
-->
<base href="/">
<!-- <base href="/interpreter/"> -->
<!-- <base href="http://localhost/tolken/"> -->
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="Tolk2Go Tasker Web.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="tolk2go_tasker">
<link rel="stylesheet" href="./loader.css">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- <link rel="apple-touch-icon" href="http://localhost/tolken/icons/Icon-192.png"> -->
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<!-- <link rel="icon" type="image/png" href="http://localhost/tolken/favicon.png"/> -->
<title>Tolk2Go Tolken</title>
<link rel="manifest" href="manifest.json">
<!-- <link rel="manifest" href="http://localhost/tolken/manifest.json"> -->
<script>
let searchParams = new URLSearchParams(window.location.search);
if (searchParams.has('renderer')) {
window.flutterWebRenderer = searchParams.get('renderer');
console.log(searchParams.get('renderer') + ' renderer requested in the URL');
}
// The value below is injected by flutter build, do not touch.
var serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
<!-- <script src="http://localhost/tolken/flutter.js" defer></script> -->
</head>
<body>
<div class="loader"></div>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
}
}).then(function(engineInitializer) {
return engineInitializer.initializeEngine();
}).then(function(appRunner) {
return appRunner.runApp();
});
});
</script>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.15.0/firebase-analytics.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</body>
</html>
裝載機:
.loader {
border: 8px solid #f3f3f3;
border-radius: 50%;
border-top: 8px solid rgb(255, 132, 0);
border-bottom: 8px solid rgb(255, 132, 0);
width: 70px;
height: 70px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
position: fixed;
top: 40%;
left: 45%;
}
@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
現在我想顯示應用程序初始化的百分比。我該怎么做?如果我們不能得到初始化方法的進度,我應該如何顯示基于持續時間的進度百分比?