Adds sample code to TextFormField (#23680)

* Adds sample code to TextFormField
This commit is contained in:
jslavitz
2018-10-30 13:54:19 -07:00
committed by GitHub
parent 72b1a2b895
commit be7226f08e

View File

@@ -38,6 +38,27 @@ import 'theme.dart';
/// integration.
/// * [InputDecorator], which shows the labels and other visual elements that
/// surround the actual text editing widget.
///
/// ## Sample code
///
/// Creates a [TextFormField] with an [InputDecoration] and validator function.
///
/// ```dart
/// TextFormField(
/// decoration: const InputDecoration(
/// icon: Icon(Icons.person),
/// hintText: 'What do people call you?',
/// labelText: 'Name *',
/// ),
/// onSaved: (String value) {
/// // This optional block of code can be used to run
/// // code when the user saves the form.
/// },
/// validator: (String value) {
/// return value.contains('@') ? 'Do not use the @ char.' : null;
/// },
/// )
/// ```
class TextFormField extends FormField<String> {
/// Creates a [FormField] that contains a [TextField].
///