-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Add Overlay.wrap for convenience #139823
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
Add Overlay.wrap for convenience #139823
Conversation
| } | ||
| } | ||
|
|
||
| class _WrappingOverlay extends StatefulWidget { |
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 additional stateful widget is needed because we want to be able to reuse the OverlayEntry?
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.
Yeah, the OverlayEntry is stateful, so we want to hold on to it.
| @override | ||
| void didUpdateWidget(_WrappingOverlay oldWidget) { | ||
| super.didUpdateWidget(oldWidget); | ||
| _entry.markNeedsBuild(); |
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: not that it makes a difference, but why do we need to call _entry.markNeedsBuild() here?
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.
So the builder of the OverlayEntry is called again in case widget.child changes.
Manual roll requested by dit@google.com flutter/flutter@c642f4e...9719097 2023-12-11 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5587d26aa2d4 to 4c309195b79d (1 revision) (flutter/flutter#139936) 2023-12-11 rmolivares@renzo-olivares.dev Fix SelectionArea select-word edge cases (flutter/flutter#136920) 2023-12-11 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9b85b76db0de to 5587d26aa2d4 (3 revisions) (flutter/flutter#139933) 2023-12-11 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7eb6b7cab60c to 9b85b76db0de (2 revisions) (flutter/flutter#139931) 2023-12-11 31859944+LongCatIsLooong@users.noreply.github.com Use dart analyze package for `num.clamp` (flutter/flutter#139867) 2023-12-11 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#139926) 2023-12-11 jhy03261997@gmail.com Handle the case when _CupertinoBackGestureDetector is disposed during the drag. (flutter/flutter#139585) 2023-12-11 barpac02@gmail.com Add accessibility identifier to `SemanticsProperties` (flutter/flutter#138331) 2023-12-11 38378650+hgraceb@users.noreply.github.com Improve slider's value indicator display test (flutter/flutter#139198) 2023-12-11 mateusfccp@gmail.com Add `enabled` property to `ExpansionTile` (flutter/flutter#139519) 2023-12-11 engine-flutter-autoroll@skia.org Roll Packages from 6cd0657 to cb6dbcd (9 revisions) (flutter/flutter#139911) 2023-12-11 engine-flutter-autoroll@skia.org Roll Flutter Engine from bc0222b64c96 to 7eb6b7cab60c (1 revision) (flutter/flutter#139891) 2023-12-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from fb80aafd259b to bc0222b64c96 (1 revision) (flutter/flutter#139885) 2023-12-09 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#139864) 2023-12-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from b75960a5820a to fb80aafd259b (1 revision) (flutter/flutter#139863) 2023-12-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from e80c090d09c6 to b75960a5820a (1 revision) (flutter/flutter#139853) 2023-12-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from 101396fd3b82 to e80c090d09c6 (2 revisions) (flutter/flutter#139851) 2023-12-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from 503584615fd7 to 101396fd3b82 (2 revisions) (flutter/flutter#139847) 2023-12-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from e9cb19fa637a to 503584615fd7 (1 revision) (flutter/flutter#139837) 2023-12-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7dc51b85a634 to e9cb19fa637a (1 revision) (flutter/flutter#139831) 2023-12-08 xilaizhang@google.com [flutter release] Add cherry pick template for pull request description (flutter/flutter#139590) 2023-12-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 03c5f016e919 to 7dc51b85a634 (1 revision) (flutter/flutter#139829) 2023-12-08 goderbauer@google.com Add Overlay.wrap for convenience (flutter/flutter#139823) 2023-12-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 72da960e2ef2 to 03c5f016e919 (1 revision) (flutter/flutter#139826) 2023-12-08 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5dd2619c282b to 72da960e2ef2 (1 revision) (flutter/flutter#139821) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC dit@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Towards #137875.
The convenient
Overlay.wrapfunction makes it easy to wrap a child with an Overlay so other visual elements can float on top of the child. This is useful if you want to get things like text selection working (i.e. with a SelectionArea) without using a Navigator.