Unverified Commit be7226f0 authored by jslavitz's avatar jslavitz Committed by GitHub

Adds sample code to TextFormField (#23680)

* Adds sample code to TextFormField
parent 72b1a2b8
......@@ -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].
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment