Adds sample code to TextFormField (#23680)
* Adds sample code to TextFormField
This commit is contained in:
@@ -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].
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user