Skip to content

Conversation

@goderbauer
Copy link
Member

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.

Copy link
Contributor

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

Copy link
Contributor

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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not minPaintExtent?

Copy link
Member Author

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 :)

Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extent, not extend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extent

@Hixie
Copy link
Contributor

Hixie commented Aug 31, 2017

This is great although I'd be happier if we didn't bake the term "pinned" into the slivers API.

@Hixie
Copy link
Contributor

Hixie commented Aug 31, 2017

LGTM

@goderbauer
Copy link
Member Author

Renamed and removed the word "pinned" from the API. Will merge on green if no further comments.

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.
@goderbauer goderbauer merged commit 30fd06f into flutter:master Sep 5, 2017
@goderbauer goderbauer deleted the pinnedShowOnScreen branch September 5, 2017 19:42
@goderbauer goderbauer added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Oct 17, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants