Fix the layout calculation in sliver list where the scroll offset cor…#59888
Merged
fluttergithubbot merged 3 commits intoflutter:masterfrom Jun 23, 2020
Merged
Fix the layout calculation in sliver list where the scroll offset cor…#59888fluttergithubbot merged 3 commits intoflutter:masterfrom
fluttergithubbot merged 3 commits intoflutter:masterfrom
Conversation
…rection accidently set the child with layout offset of zero
Piinks
approved these changes
Jun 23, 2020
| testWidgets( | ||
| 'SliverList can handle inaccurate scroll offset due to changes in children list', | ||
| (WidgetTester tester) async { | ||
| bool skip = true; |
Contributor
There was a problem hiding this comment.
Can you add one of those issue references in case it gets lost in history?
goderbauer
approved these changes
Jun 23, 2020
| }, | ||
| ); | ||
|
|
||
| testWidgets( |
Member
There was a problem hiding this comment.
Add: "Regression test for " here?
|
|
||
| assert(childScrollOffset(firstChild) > -precisionErrorTolerance); | ||
|
|
||
| // If the scroll offset is at the zero, we should make sure we are |
Member
There was a problem hiding this comment.
Suggested change
| // If the scroll offset is at the zero, we should make sure we are | |
| // If the scroll offset is at zero, we should make sure we are |
| assert(childScrollOffset(firstChild) > -precisionErrorTolerance); | ||
|
|
||
| // If the scroll offset is at the zero, we should make sure we are | ||
| // actually at the beginning of the list |
|
Google testing passed! |
1 similar comment
|
Google testing passed! |
mingwandroid
pushed a commit
to mingwandroid/flutter
that referenced
this pull request
Sep 6, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

…rection accidently set the child with layout offset of zero
Description
consider following example:
we have sliver list with items where each item has 10 paint extent. the screen is at item 10
-------start of screen----------
item 10 -- layout offset 100
item 11 -- layout offset 110
item 12 -- layout offset 120
item 13 -- layout offset 130
-------end of screen-----------
now, the sliver list children updated, and the each item has 20 paint extent. The RenderSliverList is smart to update the children scroll offset after the first child. So it become like this
-------start of screen----------
item 10 -- layout offset 100
item 11 -- layout offset 120
-------end of screen-----------
item 12 and 13 are not in the screen so it will be destroy.
Now, start scrolling back
-------start of screen----------
item 9 -- layout offset 80
item 11 -- layout offset 100
-------end of screen-----------
...keep scrolling
-------start of screen----------
item 5 -- layout offset 0
item 11 -- layout offset 20
-------end of screen-----------
oops, the sliver list think item 5 is the start of the list, so you cannot scroll any further.
Related Issues
Fixes #59819
Tests
I added the following tests:
see files
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.