A package provides an easy way to add shimmer effect in Flutter project
Add support shader
import 'package:shimmer/shimmer.dart';
ShimmerFromShader.fromShader(
shader: snapshot.data!,
child: const SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
BannerPlaceholder(),
TitlePlaceholder(width: double.infinity),
SizedBox(height: 16.0),
ContentPlaceholder(
lineType: ContentLineType.threeLines,
),
SizedBox(height: 16.0),
TitlePlaceholder(width: 200.0),
SizedBox(height: 16.0),
ContentPlaceholder(
lineType: ContentLineType.twoLines,
),
SizedBox(height: 16.0),
TitlePlaceholder(width: 200.0),
SizedBox(height: 16.0),
ContentPlaceholder(
lineType: ContentLineType.twoLines,
),
],
),
));
import 'package:shimmer/shimmer.dart';
SizedBox(
width: 200.0,
height: 100.0,
child: Shimmer.fromColors(
baseColor: Colors.red,
highlightColor: Colors.yellow,
child: Text(
'Shimmer',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 40.0,
fontWeight:
FontWeight.bold,
),
),
),
);