content: import 'package:flutter/material.dart';
  import 'package:flutter/animation.dart';
  import 'package:flutter_ui_jumble/screens/ripple_animation/circle_painter.dart';
  import 'package:flutter_ui_jumble/screens/ripple_animation/curve_wave.dart';
  
  class RipplesAnimation extends StatefulWidget {
    const RipplesAnimation({Key? key}) : super(key: key);
  
    final double size = 80.0;
    final Color color = Colors.blue;
  
    @override
    _RipplesAnimationState createState() => _RipplesAnimationState();
  }
  
  class _RipplesAnimationState extends State<RipplesAnimation> with TickerProviderStateMixin {
    late AnimationController _controller;
    @override
    void initState() {
      super.initState();
      _controller = AnimationController(
        duration: const Duration(milliseconds: 2000),
        vsync: this,
      )..repeat();
    }
    @override
    void dispose() {
      _controller.dispose();
      super.dispose();
    }
    Widget _button() {
      return Center(
        child: ClipRRect(
          borderRadius: BorderRadius.circular(widget.size),
          child: DecoratedBox(
            decoration: BoxDecoration(
              gradient: RadialGradient(
                colors: <Color>[
                  widget.color,
                  Color.lerp(widget.color, Colors.black, .05)!
                ],
              ),
            ),
            child: ScaleTransition(
                scale: Tween(begin: 0.95, end: 1.0).animate(
                  CurvedAnimation(
                    parent: _controller,
                    curve: const CurveWave(),
                  ),
                ),
                child: Icon(Icons.smartphone, size: 44, color: Colors.white,)
            ),
          ),
        ),
      );
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: CustomPaint(
            painter: CirclePainter(
              _controller,
              widget.color,
            ),
            child: SizedBox(
              width: widget.size * 4.125,
              height: widget.size * 4.125,
              child: _button(),
            ),
          ),
        ),
      );
    }
  }