detectScroll function

void detectScroll({
  1. required ScrollController scrollController,
  2. required AnimationController animationController,
})

To indicate when ScrollController is in motion.

Implementation

void detectScroll({
  required ScrollController scrollController,
  required AnimationController animationController,
}) {
  scrollController.addListener(() {
    if (scrollController.position.hasPixels) {
      animationController.forward();
    }
  });
}