@@ -20,8 +20,7 @@ class MaterialTextInputDialog extends StatefulWidget {
20
20
this .autoSubmit = false ,
21
21
});
22
22
@override
23
- _MaterialTextInputDialogState createState () =>
24
- _MaterialTextInputDialogState ();
23
+ _MaterialTextInputDialogState createState () => _MaterialTextInputDialogState ();
25
24
26
25
final List <DialogTextField > textFields;
27
26
final String ? title;
@@ -38,9 +37,8 @@ class MaterialTextInputDialog extends StatefulWidget {
38
37
}
39
38
40
39
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 ();
44
42
final _formKey = GlobalKey <FormState >();
45
43
var _autovalidateMode = AutovalidateMode .disabled;
46
44
@@ -85,8 +83,7 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
85
83
final cancelLabel = widget.cancelLabel;
86
84
final okLabel = widget.okLabel;
87
85
final okText = Text (
88
- (widget.fullyCapitalized ? okLabel? .toUpperCase () : okLabel) ??
89
- MaterialLocalizations .of (context).okButtonLabel,
86
+ (widget.fullyCapitalized ? okLabel? .toUpperCase () : okLabel) ?? MaterialLocalizations .of (context).okButtonLabel,
90
87
style: TextStyle (
91
88
color: widget.isDestructiveAction ? colorScheme.error : null ,
92
89
),
@@ -114,27 +111,25 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
114
111
),
115
112
..._textControllers.mapIndexed ((i, c) {
116
113
final isLast = widget.textFields.length == i + 1 ;
117
- final textField = widget.textFields[i];
114
+ final field = widget.textFields[i];
118
115
return TextFormField (
119
116
controller: c,
120
117
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,
127
124
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,
131
128
),
132
- validator: textField .validator,
129
+ validator: field .validator,
133
130
autovalidateMode: _autovalidateMode,
134
131
textInputAction: isLast ? null : TextInputAction .next,
135
- onFieldSubmitted: isLast && widget.autoSubmit
136
- ? (_) => submitIfValid ()
137
- : null ,
132
+ onFieldSubmitted: isLast && widget.autoSubmit ? (_) => submitIfValid () : null ,
138
133
);
139
134
})
140
135
],
@@ -143,9 +138,7 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
143
138
TextButton (
144
139
onPressed: cancel,
145
140
child: Text (
146
- (widget.fullyCapitalized
147
- ? cancelLabel? .toUpperCase ()
148
- : cancelLabel) ??
141
+ (widget.fullyCapitalized ? cancelLabel? .toUpperCase () : cancelLabel) ??
149
142
MaterialLocalizations .of (context).cancelButtonLabel,
150
143
),
151
144
),
0 commit comments