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

SliverFloatingHeader #11

Open
2 tasks
Kavantix opened this issue Sep 24, 2020 · 9 comments
Open
2 tasks

SliverFloatingHeader #11

Kavantix opened this issue Sep 24, 2020 · 9 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Kavantix
Copy link
Owner

A sliver that acts like a SliverToBoxAdapter when the user scrolls towards the leading edge but acts like a pinned header when the user scrolls back

Requirements:

  • Size of header is determined by its child
  • The header scrolls back interactively

Questions:

  • What should the behavior be when multiple of these headers are added to a viewport
  • What if this is combined with a regular pinned header before/after it
@obiwanzenobi
Copy link

I found a widget that acts like you described: https://gist.github.com/tomaszpolanski/cf0edb7961d2304c2f293da9971cd4c9

@Kavantix
Copy link
Owner Author

Kavantix commented Oct 1, 2020

@obiwanzenobi thanks for linking that gist.
I think I already looked at this one, it indeed might be a good starting point.
Can I assume you are looking for a widget with this behavior?
If so do you perhaps have input on the two questions I posed?

@Kavantix Kavantix added enhancement New feature or request help wanted Extra attention is needed labels Jan 6, 2021
@pavittarsingh315
Copy link

pavittarsingh315 commented May 2, 2022

Was about to open an enhancement request till I saw this. Is there any such functionality like this within the sliver_tools package?

I have a NestedScrollView whose headerSliverBuilder returns a SliverPersistentHeader and a SliverPinnedHeader but I want the pinned header to hide when we scroll to the bottom but show itself when we scroll to the top. This is basically the floating functionality on SliverAppBar and the functionality described here.

I tried using the gist provided but its fairly outdated and didn't seem to work.

@ABausG
Copy link

ABausG commented Sep 29, 2022

I actually use this to achieve a certain behaviour. Regarding your questions I think it already behaves like I would expect it.

Regarding your questions

What if this is combined with a regular pinned header before/after it
If all FloatingHeader are in a Group of PersistentHeaders (Pinned, Floating) In that case the FloatingHeader should scroll away but not be effecting by Overscroll Effects when dragging down For example

What should the behavior be when multiple of these headers are added to a viewport
If there is a non persistent Sliver between multiple of these headers it should behave more or less like a SliverToBoxAdapter

@marcoredz
Copy link

marcoredz commented Oct 21, 2022

Was about to open an enhancement request till I saw this. Is there any such functionality like this within the sliver_tools package?

I have a NestedScrollView whose headerSliverBuilder returns a SliverPersistentHeader and a SliverPinnedHeader but I want the pinned header to hide when we scroll to the bottom but show itself when we scroll to the top. This is basically the floating functionality on SliverAppBar and the functionality described here.

I tried using the gist provided but its fairly outdated and didn't seem to work.

I tried the example in the gist of tomaszpolanski and for me it actually works well.
In fact I merged the SliverPinnedHeader of this package and the code of that gist and created an hybrid that takes a parameter named floating that triggers the floating behavior.
I used it in a real scenario with the first sliver header set as floating and the second one pinned (without setting floating: true) and it works fine.

Here the new widget that I named SliverFlexibleHeader: https://gist.github.com/marcoredz/b2a37ff2cd11f81fa4ff7fb004fbb0ab

@Kavantix any opinions about this? maybe it could be a nice feature to add to your package

@Kavantix
Copy link
Owner Author

@marcoredz I took a quick look at your implementation and it looks like a good starting point.
You can open a PR for it if you want

@marcoredz
Copy link

@Kavantix what do you suggest between: taking the existing SliverPinnedHeader and editing it, or creating a new widget?

@Kavantix
Copy link
Owner Author

I would create a new one for this

@AlaaEldeenYsr
Copy link

It doesn't work when it's put inside MultiSliver or SliverMainAxisGroup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants