Commit 930b52a3 authored by Adam Barth's avatar Adam Barth Committed by Adam Barth

Rename InputFormField to TextField

This patch is the first of a series to rationalize the names of the text-input
related widgets.

See #7031
parent 32fea4db
......@@ -205,7 +205,7 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
onCancel: () { Form.of(context).reset(); close(); },
child: new Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: new InputFormField(
child: new TextField(
hintText: item.hint,
labelText: item.name,
initialValue: new InputValue(text: item.value),
......
......@@ -113,7 +113,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
child: new Block(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
children: <Widget>[
// It's simpler to use an InputFormField, as below, but a FormField
// It's simpler to use an TextField, as below, but a FormField
// that builds an Input is equivalent.
new FormField<InputValue>(
initialValue: InputValue.empty,
......@@ -130,7 +130,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
);
},
),
new InputFormField(
new TextField(
icon: new Icon(Icons.phone),
hintText: 'Where can we reach you?',
labelText: 'Phone Number',
......@@ -138,7 +138,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
onSaved: (InputValue val) { person.phoneNumber = val.text; },
validator: _validatePhoneNumber,
),
new InputFormField(
new TextField(
hintText: 'Tell us about yourself (optional)',
labelText: 'Life story',
maxLines: 3,
......@@ -147,7 +147,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Expanded(
child: new InputFormField(
child: new TextField(
key: _passwordFieldKey,
hintText: 'How do you log in?',
labelText: 'New Password',
......@@ -157,7 +157,7 @@ class TextFieldDemoState extends State<TextFieldDemo> {
),
new SizedBox(width: 16.0),
new Expanded(
child: new InputFormField(
child: new TextField(
hintText: 'How do you log in?',
labelText: 'Re-type Password',
hideText: true,
......
......@@ -386,7 +386,7 @@ class _InputContainerState extends State<InputContainer> {
///
/// Requires one of its ancestors to be a [Material] widget.
///
/// When using inside a [Form], consider using [InputFormField] instead.
/// When using inside a [Form], consider using [TextField] instead.
///
/// Assuming that the input is already focused, the basic data flow for
/// retrieving user input is:
......@@ -402,14 +402,14 @@ class _InputContainerState extends State<InputContainer> {
/// See also:
///
/// * <https://material.google.com/components/text-fields.html>
/// * [InputFormField], which simplifies steps 2-4 above.
/// * [TextField], which simplifies steps 2-4 above.
class Input extends StatefulWidget {
/// Creates a text input field.
///
/// By default, the input uses a keyboard appropriate for text entry.
//
// If you change this constructor signature, please also update
// InputContainer, InputFormField, InputField.
// If you change this constructor signature, please also update
// InputContainer, TextField, InputField.
Input({
Key key,
this.value,
......@@ -553,10 +553,10 @@ class _InputState extends State<Input> {
/// pass a [GlobalKey] to the constructor and use [GlobalKey.currentState] to
/// save or reset the form field.
///
/// To see the use of [InputFormField], compare these two ways of a implementing
/// To see the use of [TextField], compare these two ways of a implementing
/// a simple two text field form.
///
/// Using [InputFormField]:
/// Using [TextField]:
///
/// ```dart
/// String _firstName, _lastName;
......@@ -566,11 +566,11 @@ class _InputState extends State<Input> {
/// key: _formKey,
/// child: new Row(
/// children: <Widget>[
/// new InputFormField(
/// new TextField(
/// labelText: 'First Name',
/// onSaved: (InputValue value) { _firstName = value.text; }
/// ),
/// new InputFormField(
/// new TextField(
/// labelText: 'Last Name',
/// onSaved: (InputValue value) { _lastName = value.text; }
/// ),
......@@ -613,8 +613,8 @@ class _InputState extends State<Input> {
/// ),
/// )
/// ```
class InputFormField extends FormField<InputValue> {
InputFormField({
class TextField extends FormField<InputValue> {
TextField({
Key key,
GlobalKey focusKey,
TextInputType keyboardType: TextInputType.text,
......
......@@ -197,7 +197,10 @@ typedef Widget FormFieldBuilder<T>(FormFieldState<T> field);
/// pass a [GlobalKey] to the constructor and use [GlobalKey.currentState] to
/// save or reset the form field.
///
/// See also: [Form], [InputFormField]
/// See also:
///
/// * [Form], which is the widget that aggregates the form fields.
/// * [TextField], which is a commonly used form field for entering text.
class FormField<T> extends StatefulWidget {
FormField({
Key key,
......
......@@ -46,7 +46,7 @@ class SampleForm extends StatelessWidget {
willPopCount += 1;
return callback();
},
child: new InputFormField(),
child: new TextField(),
),
),
);
......
......@@ -29,7 +29,7 @@ void main() {
child: new Material(
child: new Form(
key: formKey,
child: new InputFormField(
child: new TextField(
onSaved: (InputValue value) { fieldValue = value.text; },
),
)
......@@ -61,7 +61,7 @@ void main() {
return new Center(
child: new Material(
child: new Form(
child: new InputFormField(
child: new TextField(
onChanged: (InputValue value) { fieldValue = value.text; },
),
)
......@@ -96,7 +96,7 @@ void main() {
child: new Form(
key: formKey,
autovalidate: autovalidate,
child: new InputFormField(
child: new TextField(
key: inputKey,
validator: errorText,
),
......@@ -151,10 +151,10 @@ void main() {
key: focusKey,
child: new Block(
children: <Widget>[
new InputFormField(
new TextField(
key: fieldKey
),
new InputFormField(
new TextField(
validator: errorText,
),
]
......@@ -190,7 +190,7 @@ void main() {
return new Center(
child: new Material(
child: new Form(
child: new InputFormField(
child: new TextField(
key: inputKey,
initialValue: new InputValue(text: initialValue),
),
......@@ -229,7 +229,7 @@ void main() {
child: new Material(
child: new Form(
key: formKey,
child: remove ? new Container() : new InputFormField(
child: remove ? new Container() : new TextField(
key: fieldKey,
autofocus: true,
onSaved: (InputValue value) { fieldValue = value.text; },
......
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