Skip to content

Commit 086db34

Browse files
committed
format files
1 parent bec7d0f commit 086db34

File tree

3 files changed

+47
-20
lines changed

3 files changed

+47
-20
lines changed

lib/src/text_input_dialog/ios_text_input_dialog.dart

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class IOSTextInputDialog extends StatefulWidget {
3434
}
3535

3636
class _IOSTextInputDialogState extends State<IOSTextInputDialog> {
37-
late final List<TextEditingController> _textControllers =
38-
widget.textFields.map((tf) => TextEditingController(text: tf.initialText)).toList();
37+
late final List<TextEditingController> _textControllers = widget.textFields
38+
.map((tf) => TextEditingController(text: tf.initialText))
39+
.toList();
3940
String? _validationMessage;
4041
bool _autovalidate = false;
4142

@@ -141,7 +142,9 @@ class _IOSTextInputDialogState extends State<IOSTextInputDialog> {
141142
isBottomRounded: i == _textControllers.length - 1,
142143
),
143144
textInputAction: isLast ? null : TextInputAction.next,
144-
onSubmitted: isLast && widget.autoSubmit ? (_) => submitIfValid() : null,
145+
onSubmitted: isLast && widget.autoSubmit
146+
? (_) => submitIfValid()
147+
: null,
145148
);
146149
},
147150
),
@@ -168,15 +171,20 @@ class _IOSTextInputDialogState extends State<IOSTextInputDialog> {
168171
onPressed: cancel,
169172
isDefaultAction: true,
170173
child: Text(
171-
widget.cancelLabel ?? MaterialLocalizations.of(context).cancelButtonLabel.capitalizedForce,
174+
widget.cancelLabel ??
175+
MaterialLocalizations.of(context)
176+
.cancelButtonLabel
177+
.capitalizedForce,
172178
),
173179
),
174180
CupertinoDialogAction(
175181
onPressed: submitIfValid,
176182
child: Text(
177183
widget.okLabel ?? MaterialLocalizations.of(context).okButtonLabel,
178184
style: TextStyle(
179-
color: widget.isDestructiveAction ? CupertinoColors.systemRed.resolveFrom(context) : null,
185+
color: widget.isDestructiveAction
186+
? CupertinoColors.systemRed.resolveFrom(context)
187+
: null,
180188
),
181189
),
182190
),

lib/src/text_input_dialog/macos_text_input_dialog.dart

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ class MacOSTextInputDialog extends StatefulWidget {
3737
}
3838

3939
class _MacOSTextInputDialogState extends State<MacOSTextInputDialog> {
40-
late final List<TextEditingController> _textControllers =
41-
widget.textFields.map((tf) => TextEditingController(text: tf.initialText)).toList();
40+
late final List<TextEditingController> _textControllers = widget.textFields
41+
.map((tf) => TextEditingController(text: tf.initialText))
42+
.toList();
4243
String? _validationMessage;
4344
bool _autovalidate = false;
4445

@@ -142,10 +143,15 @@ class _MacOSTextInputDialogState extends State<MacOSTextInputDialog> {
142143
maxLines: field.maxLines,
143144
maxLength: field.maxLenght,
144145
autocorrect: field.autocorrect,
145-
prefix: prefixText == null ? null : Text(prefixText),
146-
suffix: suffixText == null ? null : Text(suffixText),
147-
textInputAction: isLast ? null : TextInputAction.next,
148-
onSubmitted: isLast && widget.autoSubmit ? (_) => submitIfValid() : null,
146+
prefix:
147+
prefixText == null ? null : Text(prefixText),
148+
suffix:
149+
suffixText == null ? null : Text(suffixText),
150+
textInputAction:
151+
isLast ? null : TextInputAction.next,
152+
onSubmitted: isLast && widget.autoSubmit
153+
? (_) => submitIfValid()
154+
: null,
149155
),
150156
),
151157
);
@@ -170,7 +176,10 @@ class _MacOSTextInputDialogState extends State<MacOSTextInputDialog> {
170176
isSecondary: true,
171177
onPressed: cancel,
172178
child: Text(
173-
widget.cancelLabel ?? MaterialLocalizations.of(context).cancelButtonLabel.capitalizedForce,
179+
widget.cancelLabel ??
180+
MaterialLocalizations.of(context)
181+
.cancelButtonLabel
182+
.capitalizedForce,
174183
),
175184
),
176185
const SizedBox(width: 14),
@@ -179,9 +188,12 @@ class _MacOSTextInputDialogState extends State<MacOSTextInputDialog> {
179188
onPressed: submitIfValid,
180189
isSecondary: widget.isDestructiveAction,
181190
child: Text(
182-
widget.okLabel ?? MaterialLocalizations.of(context).okButtonLabel,
191+
widget.okLabel ??
192+
MaterialLocalizations.of(context).okButtonLabel,
183193
style: TextStyle(
184-
color: widget.isDestructiveAction ? CupertinoColors.systemRed.resolveFrom(context) : null,
194+
color: widget.isDestructiveAction
195+
? CupertinoColors.systemRed.resolveFrom(context)
196+
: null,
185197
),
186198
),
187199
),

lib/src/text_input_dialog/material_text_input_dialog.dart

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

2526
final List<DialogTextField> textFields;
2627
final String? title;
@@ -37,8 +38,9 @@ class MaterialTextInputDialog extends StatefulWidget {
3738
}
3839

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

@@ -83,7 +85,8 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
8385
final cancelLabel = widget.cancelLabel;
8486
final okLabel = widget.okLabel;
8587
final okText = Text(
86-
(widget.fullyCapitalized ? okLabel?.toUpperCase() : okLabel) ?? MaterialLocalizations.of(context).okButtonLabel,
88+
(widget.fullyCapitalized ? okLabel?.toUpperCase() : okLabel) ??
89+
MaterialLocalizations.of(context).okButtonLabel,
8790
style: TextStyle(
8891
color: widget.isDestructiveAction ? colorScheme.error : null,
8992
),
@@ -129,7 +132,9 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
129132
validator: textField.validator,
130133
autovalidateMode: _autovalidateMode,
131134
textInputAction: isLast ? null : TextInputAction.next,
132-
onFieldSubmitted: isLast && widget.autoSubmit ? (_) => submitIfValid() : null,
135+
onFieldSubmitted: isLast && widget.autoSubmit
136+
? (_) => submitIfValid()
137+
: null,
133138
);
134139
})
135140
],
@@ -138,7 +143,9 @@ class _MaterialTextInputDialogState extends State<MaterialTextInputDialog> {
138143
TextButton(
139144
onPressed: cancel,
140145
child: Text(
141-
(widget.fullyCapitalized ? cancelLabel?.toUpperCase() : cancelLabel) ??
146+
(widget.fullyCapitalized
147+
? cancelLabel?.toUpperCase()
148+
: cancelLabel) ??
142149
MaterialLocalizations.of(context).cancelButtonLabel,
143150
),
144151
),

0 commit comments

Comments
 (0)