Flutter Web Project Loading Animation Change

Sameera Perera
1 min readApr 6, 2021

In flutter web, the default loading screen has only white space. it’s not very user-friendly. so we can add some loading spinner for the screen by changing ‘web/index.html’ in our flutter project folder.

index.html header

<style>
body {background-color: #212121;}

.loading {
display: flex;
justify-content: center;
align-items: center;
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}

.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border: 15px solid;
border-top: 16px solid #FFFFFF;
border-right: 16px solid #212121;
border-bottom: 16px solid #FFFFFF;
border-left: 16px solid #212121;
width: 120px;
height: 120px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}

@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>

index.html body

<div class="loading">
<div class="loader"></div>
</div>
<script src="main.dart.js" type="application/javascript"></script>

Still, have a problem? check my You tube video.

--

--

Sameera Perera

Hi There! I'm Sameera Perera, a Mobile App developer, technical writer and you tuber based in Sri Lanka.