animateWidgetErrorShake method

Widget animateWidgetErrorShake({
  1. required bool trigger,
  2. Color color = Colors.red,
  3. int durationMs = 500,
  4. double hz = 10,
  5. bool repeat = false,
  6. bool animate = true,
})
  1. Error Shake

Implementation

Widget animateWidgetErrorShake(
    {required bool trigger,
    Color color = Colors.red,
    int durationMs = 500,
    double hz = 10,
    bool repeat = false,
    bool animate = true}) {
  if (!animate || !trigger) return this;
  return _baseAnimate(repeat: repeat)
      .shakeX(hz: hz, duration: durationMs.ms)
      .custom(
        duration: durationMs.ms,
        builder: (_, v, c) => Container(
          decoration: BoxDecoration(boxShadow: [
            BoxShadow(
                color: color.withColorOpacity(0.2 * (1 - v)), blurRadius: 10)
          ]),
          child: c,
        ),
      );
}