Skip to content

Commit feab384

Browse files
committed
changed textField to fields to match same pattern on other files
1 parent 086db34 commit feab384

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

lib/src/text_input_dialog/material_text_input_dialog.dart

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class MaterialTextInputDialog extends StatefulWidget {
2020
this.autoSubmit = false,
2121
});
2222
@override
23-
_MaterialTextInputDialogState createState() =>
24-
_MaterialTextInputDialogState();
23+
_MaterialTextInputDialogState createState() => _MaterialTextInputDialogState();
2524

2625
final List<DialogTextField> textFields;
2726
final String? title;
@@ -38,9 +37,8 @@ class MaterialTextInputDialog extends StatefulWidget {
3837
}
3938

4039
class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
41-
late final List<TextEditingController> _textControllers = widget.textFields
42-
.map((tf) => TextEditingController(text: tf.initialText))
43-
.toList();
40+
late final List<TextEditingController> _textControllers =
41+
widget.textFields.map((tf) => TextEditingController(text: tf.initialText)).toList();
4442
final _formKey = GlobalKey<FormState>();
4543
var _autovalidateMode = AutovalidateMode.disabled;
4644

@@ -85,8 +83,7 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
8583
final cancelLabel = widget.cancelLabel;
8684
final okLabel = widget.okLabel;
8785
final okText = Text(
88-
(widget.fullyCapitalized ? okLabel?.toUpperCase() : okLabel) ??
89-
MaterialLocalizations.of(context).okButtonLabel,
86+
(widget.fullyCapitalized ? okLabel?.toUpperCase() : okLabel) ?? MaterialLocalizations.of(context).okButtonLabel,
9087
style: TextStyle(
9188
color: widget.isDestructiveAction ? colorScheme.error : null,
9289
),
@@ -114,27 +111,25 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
114111
),
115112
..._textControllers.mapIndexed((i, c) {
116113
final isLast = widget.textFields.length == i + 1;
117-
final textField = widget.textFields[i];
114+
final field = widget.textFields[i];
118115
return TextFormField(
119116
controller: c,
120117
autofocus: i == 0,
121-
obscureText: textField.obscureText,
122-
keyboardType: textField.keyboardType,
123-
minLines: textField.minLines,
124-
maxLines: textField.maxLines,
125-
maxLength: textField.maxLenght,
126-
autocorrect: textField.autocorrect,
118+
obscureText: field.obscureText,
119+
keyboardType: field.keyboardType,
120+
minLines: field.minLines,
121+
maxLines: field.maxLines,
122+
maxLength: field.maxLenght,
123+
autocorrect: field.autocorrect,
127124
decoration: InputDecoration(
128-
hintText: textField.hintText,
129-
prefixText: textField.prefixText,
130-
suffixText: textField.suffixText,
125+
hintText: field.hintText,
126+
prefixText: field.prefixText,
127+
suffixText: field.suffixText,
131128
),
132-
validator: textField.validator,
129+
validator: field.validator,
133130
autovalidateMode: _autovalidateMode,
134131
textInputAction: isLast ? null : TextInputAction.next,
135-
onFieldSubmitted: isLast && widget.autoSubmit
136-
? (_) => submitIfValid()
137-
: null,
132+
onFieldSubmitted: isLast && widget.autoSubmit ? (_) => submitIfValid() : null,
138133
);
139134
})
140135
],
@@ -143,9 +138,7 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
143138
TextButton(
144139
onPressed: cancel,
145140
child: Text(
146-
(widget.fullyCapitalized
147-
? cancelLabel?.toUpperCase()
148-
: cancelLabel) ??
141+
(widget.fullyCapitalized ? cancelLabel?.toUpperCase() : cancelLabel) ??
149142
MaterialLocalizations.of(context).cancelButtonLabel,
150143
),
151144
),

0 commit comments

Comments
 (0)