-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[framework] SliverDecoration #107269
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
[framework] SliverDecoration #107269
Conversation
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
I don't think the golden tests I added are super useful, I'll update them a bit so they actually have some content |
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Renamed to SliverDecoration to matching existing sliver widgets |
Piinks
left a comment
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.
Love this! 😻
Can you add a reference in the docs for DecoratedBox and/or BoxDecoration to make this more discoverable?
|
|
||
| /// Paints a [Decoration] either before or after its child paints. | ||
| class RenderSliverDecoration extends RenderProxySliver { | ||
| /// Creates a decorated box. |
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
| /// Creates a decorated box. | |
| /// Creates a decorated sliver. |
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.
Fixed
|
I added some breadcrumbs to the "see also" section of the BoxDecoration and DecoratedBox docs |
Piinks
left a comment
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.
|
Golden file changes are available for triage from new commit, Click here to view. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
A widget like this is super useful but this implementation should be reverted IMHO, sorry @jonahwilliams.
The correct behaviour should be the same as using a @Piinks @jonahwilliams let me know if you rather have a new ticket created for these issues, but I stand by my point that this current implementation should NOT reach stable or beta channels if possible. It will create more issues than it solves. |
|
Well the only one I can immediately disagree with is I agree we should fix those other issues, it would be helpful if you could file bugs for the specific ones you've noticed here. Thanks! |
Well this name suggests it’s a counterpart to BoxDecoration |
|
And probably there should actually be a |
|
Yes, but then it would be named differently from all of the other Sliver* widgets |
|
You could technically name it |
|
I like SliverDecorated |
|
but its a bit odd still IMO, we don't do past tense for the most part. I.e. its SliverPadding and not SliverPadded |
|
I agree and wouldnt have even mentioned the name if it werent for BoxDecoration not being the widget but the configuration. And we’ll run into this same thing when inevitably adding a Sliver counterpart to ColoredBox. Perhaps in light of this and the widget not being finished it would make more sense to not put it in the framework itself just yet? |
This reverts commit 881b27e.
This is a second attempt to merge #107269. Currently I've fixed two of the issues: 1. Fixed horizontal scrollview by using a switch statement to consider vertical/horizontal case. 2. Fixed issue of `paintExtent` not being the right extent for painting. Rather using a `scrollExtent` for the main axis length of the decoration box and painting it offsetted by the `scrollOffset`. 3. If the sliver child has inifinite scrollExtent, then we only draw the decoration down to the bottom of the `cacheExtent`. The developer is expected to ensure that the border does not creep up above the cache area. This PR includes a test that checks that the correct rectangle is drawn at a certain scrollOffset for both the horizontal and vertical case which should be sufficient for checking that `SliverDecoration` works properly now. Fixes #107498.


Avoid situations where users place scrollable content in a Column just so they can wrap it in a Container to add some kind of BoxDecoration. For example, I've seen stuff like:
Which totally defeats the purpose of scroll views