animateLiquidFill method
Widget
animateLiquidFill(
{ - Color color = Colors.greenAccent,
- bool animate = true,
})
Implementation
Widget animateLiquidFill(
{Color color = Colors.greenAccent, bool animate = true}) {
if (!animate) return this;
return this
.animate(onPlay: (controller) => controller.repeat(reverse: true))
.custom(
duration: 3000.ms,
builder: (context, value, child) => ShaderMask(
shaderCallback: (rect) => LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [color, Colors.transparent],
stops: [value, value + 0.1],
).createShader(rect),
blendMode: BlendMode.srcATop,
child: child,
),
);
}