Skip to content

Autocomplete parameter to align options above field instead of below #129748

@gnprice

Description

@gnprice

The Autocomplete and RawAutocomplete widgets are currently hard-coded to always show the options below the input field.

This works great for many use cases. But in some use cases, the options should always appear above the field, and never below.

For example in a messaging application, the input field for composing a message is typically pinned to the bottom of the view, just above the keyboard. There's then no room for autocomplete options below that field, and it should instead go above.


There've been a few previous requests in the tracker for this feature:

There've also been a couple of requests for a related feature — to have the options dynamically appear either above or below, depending on where there's room:

The dynamic version would also be great, but seems more complicated. So I'd like to leave that as a future issue, and just design the API in a way that leaves the door open to cleanly supporting that feature later.


Specifically, I propose adding to RawAutocomplete and Autocomplete a field
with a name like alignment whose type is an enum like

enum AutocompleteAlignment { above, below }

and that defaults to AutocompleteAlignment.below. Then in the future the dynamic version can be a third value for the enum.


Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions