animateWidgetLiquidFill method

Widget animateWidgetLiquidFill({
  1. Color color = Colors.greenAccent,
  2. int durationMs = 3000,
  3. bool repeat = true,
  4. bool animate = true,
})
  1. Liquid Fill Breathe (Loop)

Implementation

Widget animateWidgetLiquidFill(
    {Color color = Colors.greenAccent,
    int durationMs = 3000,
    bool repeat = true,
    bool animate = true}) {
  if (!animate) return this;
  return _baseAnimate(repeat: repeat, reverse: true).custom(
    duration: durationMs.ms,
    builder: (_, v, child) => ShaderMask(
      shaderCallback: (rect) => LinearGradient(
        begin: Alignment.bottomCenter,
        end: Alignment.topCenter,
        colors: [color, Colors.transparent],
        stops: [v, v + 0.1],
      ).createShader(rect),
      blendMode: BlendMode.srcATop,
      child: child,
    ),
  );
}