animateWidgetErrorShake method

Widget animateWidgetErrorShake({
  1. required bool trigger,
  2. Color color = Colors.red,
  3. bool repeat = false,
  4. bool animate = true,
})
  1. Error Shake

Implementation

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