-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add a ScrollController parameter to NestedScrollView #11242
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
db1083a to
5d4ebdd
Compare
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.
can you add a test for this change?
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've reverted this change. We'll probably revisit it in a future PR.
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 "parent"?
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 matches the similarly unqualified "updateParent()" method name.
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 is the purpose of this change?
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.
Future.wait doesn't return null, so Flutter will throw an error in the logs complaining about a type mismatch.
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.
See #10925
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.
Ah, I see. Is there a test that verifies this particular issue?
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.
The new tests are tripped up by this.
00:01 +3 ~1: - NestedScrollView with a ScrollController
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test:
type '_Future<List>' is not a subtype of type 'Future<Null>' of 'function result' where
_Future is from dart:async
List is from dart:core
Future is from dart:async
Null is from dart:core
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.
Just to be clear: if I reintroduce the error, the new tests catch it.
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.
great!
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.
the "first" here is a bug factory. For example, what if there's a scroll view prior to this one in the layout? it'll be the first scroll position in the default scroll controller, but it has no particular relationship with this scroll view.
2d8c2b3 to
a09315f
Compare
|
I've eliminated the I added a TrackingScrollController class, which remembers the last scroll position that changed and reports its |
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.
Rather than returning 0.0 by default, return super.initialScrollOffset, and then have TrackingScrollController take an initialScrollOffset which it passes to the parent. That way, you can still set an initial scroll offset.
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: space after colon
9faab3f to
ad28044
Compare
The NestedScrollView changes were contributed by @collinjackson
Fixes #10925
Fixes #11153