-
Notifications
You must be signed in to change notification settings - Fork 28.9k
adds isAttached
getter to DraggableScrollableController
#100269
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
isAttached
getter to DraggableScrollControllerisAttached
getter to DraggableScrollableController
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.
Hey @maheshmnj! Can this instead use the hasClients
property that already exists on ScrollController
?
For more context, just because _attachedController is not null, does not mean there is an attached position that is safe to access. :) |
@Piinks, Oh Yes, We should use expect(controller.isAttached, false); /// would throw Null check operator used on Null value Instead of making |
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.
Thanks for the update!
/// If this is false, then members that interact with the [ScrollPosition], | ||
/// such as [sizeToPixels], [size], [animateTo], and [jumpTo], must not be | ||
/// called. | ||
bool get isAttached => _attachedController != null && _attachedController!.hasClients; |
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 update the _assertAttached function to use this getter now?
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.
Done
From triage: This probably needs to be rebased to make the failing check happy. |
Thanks for checking @goderbauer, I have rebased 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.
This pull request is not suitable for automatic merging in its current state.
|
Restarted the Google Testing check. Hopefully it will pass now. |
This PR adds
isAttached
getter to DraggableScrollableController similar toScrollController.hasClients
Fixes #99994
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.