-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix PageView throws Null check error #104405
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
Fix PageView throws Null check error #104405
Conversation
f44c7cf to
531feee
Compare
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.
LGTM! Thank you for fixing this! @xu-baolin WDYT?
|
Hey @Piinks this issue is similar to this #103328, @override
void absorb(ScrollPosition other) {
super.absorb(other);
assert(_cachedPage == null);
if (other is! _PagePosition) {
return;
}
if (other._cachedPage != null) {
_cachedPage = other._cachedPage;
other._cachedPage = null;
}
} |
xu-baolin
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.
See the comment above.
531feee to
d335c33
Compare
d335c33 to
b15311e
Compare
xu-baolin
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.
LGTM,need a second review from @Piinks
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.
Ah nice @xu-baolin! Thanks @bleroux, LGTM!
|
Anyone knows when is this landing on stable branch? |
|
The issue still exist in the flutter version 3.0.5. |
|
Yes still happening in version 3.0.5 |
|
From https://github.com/flutter/flutter/wiki/Flutter-build-release-channels, |
|
Is this expected to be fixed in 3.0.5 and it's an issue again or it wasn't included in 3.0.5? |
|
@tonyshkurenko |
|
I confirm, issue fixed in 3.3.0 release. |
Description
This PR fixes a null check error in
PageView.The null check was added by the following PR : #65015
Flutter 3.0 is the first stable release where the null check error surfaces.
It surfaces due to the following PR : #97971
which added a call to
MediaQueryinSrollableState.didChangeDependencies(line 462) :During startup, especially in release mode,
MediaQuery.of(context).sizemight return (0,0). The size will be updated when the native platform reports the actual resolution (several milliseconds later). This seems to be by design for performance reasons (see #25827 (comment)).For
PageView, it means that the Viewport dimensions are updated during startup which was not expected with the previous code.Related Issue
Fixes #101007
Tests
Adds 1 test.