Skip to content

Seeking Clarification on Sticky Header Scroll Notifications #96

@JasonYHZ

Description

@JasonYHZ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions