handleChange method

dynamic handleChange()

Implementation

handleChange() {
  if (widget.value == previous) {
    return;
  }

  controller.dispose();
  controller = AnimationController(vsync: this, duration: widget.duration);

  animation =
      ColorTween(begin: previous, end: widget.value).animate(CurvedAnimation(
    parent: controller,
    curve: widget.curve,
  ))
        ..addListener(() {
          setState(() {});
        });

  previous = widget.value;

  controller.reset();
  controller.forward();
}