-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
The Autocomplete and RawAutocomplete widgets (design doc) allow custom options via optionsViewBuilder, but the options are always placed in an Overlay at the location of RawAutocomplete with full-screen constraints. There are many common use cases that are not possible with this arrangement:
- Users may want the options in-line in the widget tree and not in an Overlay.
- Users may want the options to be the same width as the field.
- Users may want the options to be the same width as is available to the RawAutocomplete widget.
- Users may want to the options to be positioned somewhere else in the Overlay.
I think we can allow all of these use cases by adding the overlayEntryViewBuilder parameter of the following type:
Widget Function(
BuildContext context,
LayerLink fieldLayerLink,
BoxConstraints contraints,
Size fieldSize,
Widget child,
)This parameter would default to the current behavior, which builds a CompositedTransformFollower at the location of the field with full screen width.
If null is explicitly passed to this parameter, then the options will be built in-line instead of in an Overlay.
If the user passes this parameter, they can use the given arguments to handle all of the remaining use cases above. fieldSize can be used to set the options' width to the width of the field. constraints is the constraints of the Autocomplete widget, so that can be used to create options that align with that point in the widget tree.