animateWidgetCircleShimmer method
Widget
animateWidgetCircleShimmer(
{ - Alignment alignment = Alignment.center,
- Color color = Colors.white,
- int durationMs = 1500,
- bool repeat = true,
- bool animate = true,
})
- Circle Radial Shimmer (Loop)
Implementation
Widget animateWidgetCircleShimmer({
Alignment alignment = Alignment.center,
Color color = Colors.white,
int durationMs = 1500,
bool repeat = true,
bool animate = true,
}) {
if (!animate) return this;
return _baseAnimate(repeat: repeat).custom(
duration: durationMs.ms,
builder: (_, v, child) {
final double smoothV = Curves.easeInOutSine.transform(v);
return ShaderMask(
shaderCallback: (rect) => RadialGradient(
center: alignment,
radius: smoothV * 3.0,
colors: [
color.withColorOpacity(0.0),
color.withColorOpacity(0.4 * (1 - smoothV.clamp(0.7, 1.0))),
color.withColorOpacity(0.0)
],
stops: const [0.0, 0.5, 1.0],
).createShader(rect),
blendMode: BlendMode.srcATop,
child: child,
);
},
);
}