Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to hide top card when scrolling down and appear when scrolling up

Im new in flutter. And stacked in this problem, I have filter card on the top of my screen, and I want to hide and appear when scroll going down and up,
Thank in advance

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

use this

 @override
  void initState() {
    super.initState();

    scrollController!.addListener(() {
      if (scrollController!.position.userScrollDirection ==
          ScrollDirection.forward) {
        if (!isFilterVisible) {
          setState(() => visible = true);
        }
      } else if (scrollController!.position.userScrollDirection ==
          ScrollDirection.reverse) {
        setState(() => visible = false);
      }
    });
  }
CustomScrollView(
controller: scrollController)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading