doc/improve-hint-text-doc (#156313)

This PR improve the Flutter documentation about the Textfield.hintText
property. On our e-commerce app, Samsung pass was not working and we
discovered that, after using hintText : Samsung pass autofill was
working perfectly.

Example (that can help) : 
```dart
 TextFormField(
   autofillHints: const <String>[
    // Order is important, username must be first
     AutofillHints.username,
     AutofillHints.email,
   ],
   keyboardType: TextInputType.emailAddress,
   decoration: InputDecoration(
     hintText: "What do you want, it doesn't matter but it's important to use it",
  ),
 ),
 ...
 TextFormField(
   autofillHints: const <String>[AutofillHints.password],    
   obscureText: true,
   keyboardType: TextInputType.visiblePassword,
   decoration: InputDecoration(
     hintText: "What do you want, it doesn't matter but it's important to use it",
   ),
 ),
```

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

Co-authored-by: Enguerrand ARMINJON WINDOWS <enguerrand.arminjon@gmail.com>
This commit is contained in:
Enguerrand ARMINJON 2024-12-02 22:49:58 +01:00 committed by GitHub
parent 1e67f6c386
commit 0917d0da66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1833,6 +1833,10 @@ class EditableText extends StatefulWidget {
/// Autofill service. Enable the autofill service of your choice, and make /// Autofill service. Enable the autofill service of your choice, and make
/// sure there are available credentials associated with your app. /// sure there are available credentials associated with your app.
/// ///
/// Specifying [InputDecoration.hintText] may also help autofill services
/// (like Samsung Pass) determine the expected content type of an input field,
/// although this is typically not required when autofillHints are present.
///
/// #### I called `TextInput.finishAutofillContext` but the autofill save /// #### I called `TextInput.finishAutofillContext` but the autofill save
/// prompt isn't showing /// prompt isn't showing
/// ///