Repository: flutter
Issue: Autocomplete<T> missing features desktop and web users expect
Labels: a: text input,c: new feature,framework,f: material design,c: proposal,a: desktop,P3,team-text-input,triaged-text-input

## Current 2.10.2 Behavior
1. With the Autocomplete options displayed clicking the option with the mouse selects the option, and focus is placed in Autocomplete text box with the cursor at the end of the text.  _PERFECT BEHAVIOR_.

2. With the Autocomplete options displayed using the up and down arrow keys different options are displayed.  Then pressing ENTER on an option, selects that option.  BUT, focus is not visible.  The user needs to press the TAB key once to get focus on the text box. _PROBLEM_

The two above behaviors should be the same, but they are not.  Can this be fixed so that when the ENTER key is pressed the Widget behaves the same as being clicked?

3.  If the user enters text in the Autocomplete and presses ENTER or TAB, the text is accepted but the onSelected callback is not invoked. I understand why this behaves like this but at a minimum, a text entry callback should be added so that developers would be advised when the user entered text without selecting an option.


## Use case, three new behaviors needed

**ENTER and TAB keys:**  Flutter Desktop and Web users expect that the ENTER and TAB keys behave the same when pressed over an Autocomplete option.

When the options are visible, it is natural to use the up and down arrow keys for option navigation and then for a user to press either the TAB or ENTER key to select the option.

Desktop users expect and need to be able to run a desktop or web line of business application with the keyboard when performing data entry functions.  

**Validator:** No Validator function is available for the Autocomplete widget.  Desktop and web line of business applications require field validation on all fields.  This is missing for Autocomplete.  Even a super simple required validator needs to be implemented.  NOTE:  The below gist demonstrates how to provide a user-provided `fieldViewBuilder` that the user can add any TextFormField properties they desire.

**Text Entry Option:**  Currently, Autocomplete allows text entry but does not invoke the onSelected callback.  At a minimum, provide another callback so developers can handle text entry as well as item selection that is invoked when the ENTER or TAB key is pressed.

Workaround:  For now, I copied the SDK Autocomplete and RawAutocomplete widgets and modified them to support the above requirements for my line of business app.

## Proposal

1. Make the ENTER and TAB keys behave exactly as a mouse tap does when an option is clicked.
2. Add a Validator argument to Autocomplete or tell developers to provide `fieldViewBuilder` to the Autocomplete widget.
3. Add a callback for text entry made, this can be invoked when the user presses ENTER or TAB.

## Solution and Demo of Desired Behavior.

This 3 file gist provides a README.md, a customized Autocomplete widget, a small Flutter app demonstrating using the customized Autocomplete app.

[https://gist.github.com/longtimedeveloper/0b718244117f78d337489d9227d32538](https://gist.github.com/longtimedeveloper/0b718244117f78d337489d9227d32538)