Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeking Clarification on Sticky Header Scroll Notifications #96

Open
JasonYHZ opened this issue Jan 1, 2024 · 0 comments
Open

Seeking Clarification on Sticky Header Scroll Notifications #96

JasonYHZ opened this issue Jan 1, 2024 · 0 comments

Comments

@JasonYHZ
Copy link

JasonYHZ commented Jan 1, 2024

Hello,

I am currently using the flutter_sticky_header package in my project and I have a question regarding its functionality.

I am interested in receiving notifications when the sticky header scrolls out of the viewport. I understand that I can use a StickyHeaderController to listen to the current sticky header's scroll offset. However, I am not entirely sure how to determine when the header is out of the viewport using this controller.

Here is a snippet of my current implementation:

final controller = StickyHeaderController();


CustomScrollView(
slivers:[
// index 1
SliverStickyHeader(
  controller: controller,
  header: Text('Header'),
  sliver: SliverList(...),
),
// index 1
SliverStickyHeader(
  controller: controller,
  header: Text('Header'),
  sliver: SliverList(...),
),
]
)

controller.addListener(() {
});

In the above code, I am using the pinned property of the offset to determine if the header is out of the viewport. Is this the correct approach? If not, could you please provide some guidance on how to correctly implement this functionality?

Thank you for your time and assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant