-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
Implement Autocomplete
layout with the new OverlayPortal childLayoutBuilder API
#165249
Conversation
…rebuilds. The builder callback can capture free variables. So the it must be re-evaluated every time `OverlayPortal` rebuilds.
5ce671d
to
abf73ef
Compare
Looks really great! Especially getting rid of those extra pumps. I'm still familiarizing myself with the new |
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 👍 . This is definitely a lot simpler. Since all the tests pass I assume it solves all of the complicated cases that we tested in #143249.
I'm really glad we have something like this built-in now. When I was working on this layout, I knew that there must be Flutter app developers that are struggling with the same kind of layout problems. I wonder if MenuAnchor could also benefit from being migrated to this approach?
Do you know how this approach will be affected by soft keyboard opening and closing as in #157664? CC @victorsanni
} | ||
final Size fieldSize = layoutInfo.childSize; | ||
final Matrix4 invertTransform = layoutInfo.childPaintTransform.clone()..invert(); | ||
final Rect overlayRectInField = MatrixUtils.transformRect( |
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 explain to me what overlayRectInField is in relation to the field and the overlay? Just to help me follow this code.
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.
its the rect of the overlay in field view's coordinates.
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.
Oh got it! I was trying everything else in my head and couldn't get the math to make sense. Thanks for adding the comment.
@@ -326,8 +326,6 @@ void main() { | |||
|
|||
// Tap on the text field to open the options. | |||
await tester.tap(find.byKey(fieldKey)); | |||
// Two pumps required due to post frame callback. | |||
await tester.pump(); |
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.
Super excited to see the extra pumps gone.
Correct me if I'm wrong @LongCatIsLooong but wouldn't that just involve incorporating the keyboard insets in |
// rect. | ||
final Rect overlayRectInField = MatrixUtils.transformRect( | ||
invertTransform, | ||
Offset.zero & layoutInfo.overlaySize, |
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.
Do you know how this approach will be affected by soft keyboard opening and closing
Correct me if I'm wrong @LongCatIsLooong but wouldn't that just involve incorporating the keyboard insets in
optionsViewMaxHeight
?
@victorsanni I think this is the rect you want to incorporate the keyboard insets into.
autosubmit label was removed for flutter/flutter/165249, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Fixes #160625
This also makes it very easy to implement #101620.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.