mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Update loader style (#82485)
This commit is contained in:
parent
3c72ef374d
commit
e3fd8dbfd5
@ -22,40 +22,72 @@ String generateBootstrapScript({
|
|||||||
|
|
||||||
var styles = `
|
var styles = `
|
||||||
.flutter-loader {
|
.flutter-loader {
|
||||||
width: 100px;
|
width: 100%;
|
||||||
height: 100px;
|
height: 8px;
|
||||||
border: 10px solid #075b9a;
|
background-color: #13B9FD;
|
||||||
border-bottom-color: #60caf6;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: inline-block;
|
|
||||||
box-sizing: border-box;
|
|
||||||
animation: rotation 1s linear infinite;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: calc(50% - 50px);
|
top: 0px;
|
||||||
top: calc(50% - 50px);
|
left: 0px;
|
||||||
-webkit-transform: translate(-50%, -50%);
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rotation {
|
.indeterminate {
|
||||||
0% {
|
position: relative;
|
||||||
transform: rotate(0deg);
|
width: 100%;
|
||||||
}
|
height: 100%;
|
||||||
100% {
|
}
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
.indeterminate:before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #0175C2;
|
||||||
|
animation: indeterminate_first 2.0s infinite ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.indeterminate:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #02569B;
|
||||||
|
animation: indeterminate_second 2.0s infinite ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes indeterminate_first {
|
||||||
|
0% {
|
||||||
|
left: -100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
left: 100%;
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes indeterminate_second {
|
||||||
|
0% {
|
||||||
|
left: -150%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
left: 100%;
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
var styleSheet = document.createElement("style")
|
var styleSheet = document.createElement("style")
|
||||||
styleSheet.type = "text/css"
|
styleSheet.type = "text/css";
|
||||||
styleSheet.innerText = styles
|
styleSheet.innerText = styles;
|
||||||
document.head.appendChild(styleSheet)
|
document.head.appendChild(styleSheet);
|
||||||
|
|
||||||
var loader = document.createElement('div');
|
var loader = document.createElement('div');
|
||||||
loader.className = "flutter-loader";
|
loader.className = "flutter-loader";
|
||||||
document.body.append(loader);
|
document.body.append(loader);
|
||||||
|
|
||||||
|
var indeterminate = document.createElement('div');
|
||||||
|
indeterminate.className = "indeterminate";
|
||||||
|
loader.appendChild(indeterminate);
|
||||||
|
|
||||||
document.addEventListener('dart-app-ready', function (e) {
|
document.addEventListener('dart-app-ready', function (e) {
|
||||||
loader.parentNode.removeChild(loader);
|
loader.parentNode.removeChild(loader);
|
||||||
styleSheet.parentNode.removeChild(styleSheet);
|
styleSheet.parentNode.removeChild(styleSheet);
|
||||||
@ -203,7 +235,8 @@ String generateTestEntrypoint({
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Generate the unit test bootstrap file.
|
/// Generate the unit test bootstrap file.
|
||||||
String generateTestBootstrapFileContents(String mainUri, String requireUrl, String mapperUrl) {
|
String generateTestBootstrapFileContents(
|
||||||
|
String mainUri, String requireUrl, String mapperUrl) {
|
||||||
return '''
|
return '''
|
||||||
(function() {
|
(function() {
|
||||||
if (typeof document != 'undefined') {
|
if (typeof document != 'undefined') {
|
||||||
|
@ -27,6 +27,7 @@ test('generateBootstrapScript includes loading indicator', () {
|
|||||||
mapperUrl: 'mapper.js',
|
mapperUrl: 'mapper.js',
|
||||||
);
|
);
|
||||||
expect(result, contains('"flutter-loader"'));
|
expect(result, contains('"flutter-loader"'));
|
||||||
|
expect(result, contains('"indeterminate"'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('generateMainModule embeds urls correctly', () {
|
test('generateMainModule embeds urls correctly', () {
|
||||||
|
Loading…
Reference in New Issue
Block a user