-
Notifications
You must be signed in to change notification settings - Fork 29.7k
getOffsetToReveal deals with pinned slivers #11878
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: first comma is extraneous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(with the comma, it means all slivers never get pinned)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not minPaintExtent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like minPaintExtent doesn't describe the same thing. I'd for example say that the floating app bar has a minPaintExtent of zero because it can be completely invisible. However, if it is visible, it might be blocking other slivers -- and that's the extent I need to know. If this sliver is pinned at the top what's the most it can cover? Basically what I need is maxExtentByWhichSliverWillEverReduceTheScrollableAreaIfPinnedAtEdge -- that seemed too long though and maxPinnedExtent was all I could come up with. Happy to go with other suggestions, though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the floating app bar report for maxPinnedExtent when it's entirely off-screen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It reports maxExtent because that's how much space it could potentially occupy in the pinned position if it decides to become visible due to the scrolling action triggered by this call to ensureVisible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is really neither a "min" nor a "max", it's more like "protectedExtent" or some such, the region that ensureVisible should avoid. Maybe "deflectExtent", or "scrollObstructionExtent", or "scrollingOcclusionExtent" or some such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still a max because I need the maximum amount that this sliver is ever going to obstruct scrolling by.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards renaming this to maxScrollObstructionExtent: The maximum extent by which this sliver might obstruct scrolling when pinned to the edge of the scroll view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extent, not extend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extent
|
This is great although I'd be happier if we didn't bake the term "pinned" into the slivers API. |
|
Renamed and removed the word "pinned" from the API. Will merge on green if no further comments. |
f5604ab to
c3d2501
Compare
If a Sliver can potentially be pinned at the edge of a viewport, getOffsetToReveal will take that into account and scroll further up/down to ensure that the object to reveal doesn't end up covered by a pinned sliver. This is important for accessibility scrolling with app bars. Since how much a pinned sliver is covering is dynamic (it can change with scroll offset, etc), getOffsetToReveal deals with the worst case and tries to ensure that the object to uncover is visible when the pinned slivers are at their max pinned extent.
3a495e7 to
a05d07c
Compare
If a Sliver can potentially be pinned at the edge of a viewport, getOffsetToReveal will take that into account and scroll further up/down to ensure that the object to reveal doesn't end up covered by a pinned sliver.
This is important for accessibility scrolling with app bars.
Since how much a pinned sliver is covering is dynamic (it can change with scroll offset, etc), getOffsetToReveal deals with the worst case and tries to ensure that the object to uncover is visible when the pinned slivers are at their max pinned extent.