Shimmer Effect ListView Flutter

In this article, we are going to integrate shimmer effect placeholder to load listview data in flutter application. We already implemented shimmer effect animation in android platform for recyclerview.

Nowadays shimmer animation is most popular while loading large amount of data from servers in mobile applications. We are using shimmer flutter package to create shimmer placeholder in flutter application. In this flutter example, we are displaying football players info in listview.

shimmer widget has different types of properties. baseColor property is used to set color of shimmer effect in flutter listview. highlightColor property is used to display wave for shimmer animation. direction attribute is used to set direction of shimmer effect in flutter listview from left to right, right to left, top to bottom or bottom to top.

Using child property, we can declare any widget as child to display after shimmer loading animation. We can also control speed of shimmer effect placeholder using period property. Default value of period property is 1500 milliseconds. We can change this value according to our requirement.


Add required package in pubspec.yaml file

shimmer: ^2.0.0

Create Model Class to handle list view data

import ‘dart:core’;

class MyFootballPlayerInfo{

String playerImg;
String playerName;
String playingPosition;
String clubName;
String countryName;

MyFootballPlayerInfo(this.playerImg, this.playerName, this.playingPosition, this.clubName,



Add data in array to display in ListView

import ‘package:shimmereffectfluttersample/my_football_players_info.dart’;

List<MyFootballPlayerInfo> footballPlayersData = [
MyFootballPlayerInfo( “×40/p14937.png”, “Cristiano Ronaldo”, “Forward”, “Manchester United”, “Portugal”
MyFootballPlayerInfo( “×40/p61366.png”, “Kevin De Bruyne”, “Midfielder”, “Manchester City”, “Belgium”
MyFootballPlayerInfo( “×40/p66749.png”, “Romelu Lukaku”, “Forward”, “Chelsea”, “Belgium”
MyFootballPlayerInfo( “×40/p97032.png”, “Virgil van Dijk”, “Defender”, “Liverpool”, “Netherlands”
MyFootballPlayerInfo( “×40/p78830.png”, “Harry Kane”, “Forward”, “Tottenham Hotspur”, “England”
MyFootballPlayerInfo( “×40/p54694.png”, “Pierre-Emerick Aubameyang”, “Forward”, “Arsenal”, “Gabon”
MyFootballPlayerInfo( “×40/p101668.png”, “Jamie Vardy”, “Forward”, “Leicester City”, “England”
MyFootballPlayerInfo( “×40/p164511.png”, “Yerry Mina”, “Defender”, “Everton”, “Colombia”
MyFootballPlayerInfo( “×40/p103192.png”, “Kurt Zouma”, “Defender”, “West Ham United”, “France”


Create Shimmer Effect UI for Flutter ListView

import ‘package:flutter/material.dart’;
import ‘package:shimmer/shimmer.dart’;

class MyShimmerEffectUI extends StatelessWidget {

final double width;
final double height;
final ShapeBorder shapeBorder;

const MyShimmerEffectUI.rectangular({
this.width = double.infinity,
@required this.height
}): this.shapeBorder = const RoundedRectangleBorder();

const MyShimmerEffectUI.circular({
this.width = double.infinity,
@required this.height,
this.shapeBorder = const CircleBorder()

Widget build(BuildContext context) => Shimmer.fromColors(
baseColor: Colors.grey,
highlightColor: Colors.grey,
period: Duration(seconds: 3),
child: Container(
width: width,
height: height,
decoration: ShapeDecoration(
color: Colors.grey,
shape: shapeBorder,


Load Data in ListView Flutter

List<MyFootballPlayerInfo> listFootballPlayers = [];
bool isLoading = false;

void initState() {

Future loadFootballPlayersData() async {
setState(() {
isLoading = true;
await Future.delayed(Duration(seconds: 2));
listFootballPlayers = List.of(footballPlayersData);
setState(() {
isLoading = false;


Flutter Shimmer Effect Animation ListView

Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(‘Flutter Shimmer Effect ListView Sample’)),
body: ListView.builder(
itemCount: isLoading? 7: listFootballPlayers.length,
itemBuilder: (context, index) {
if (isLoading) {
return shimmerEffectUIWidget();
} else {
final footballPlayer = listFootballPlayers[index];
return listViewUI(footballPlayer);

Widget shimmerEffectUIWidget() =>
leading: MyShimmerEffectUI.circular(height: 60, width: 60),
title: Align(
alignment: Alignment.centerLeft,
child: MyShimmerEffectUI.rectangular(height: 18,
width: MediaQuery.of(context).size.width*0.35),
subtitle: MyShimmerEffectUI.rectangular(height: 16),

Widget listViewUI(MyFootballPlayerInfo myFootballPlayerInfo) =>
leading: CircleAvatar(
radius: 25,
backgroundImage: NetworkImage(myFootballPlayerInfo.playerImg),
title: Text(myFootballPlayerInfo.playerName, style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
subtitle: Text(
myFootballPlayerInfo.playingPosition + ” ” + myFootballPlayerInfo.clubName + ” ” + myFootballPlayerInfo.countryName, style: TextStyle(fontSize: 16), maxLines: 1,),

shimmer effect

Leave a Reply