@@ -56,117 +56,117 @@ class FormBuilderCupertinoDateTimePicker extends FormBuilderField<DateTime> {
56
56
final StrutStyle strutStyle;
57
57
58
58
//
59
- final Locale ? locale;
60
- final DateFormat ? format;
59
+ final bool alwaysUse24HourFormat;
61
60
final CupertinoDateTimePickerInputType inputType;
61
+ final DateCancelledCallback ? onCancel;
62
+ final DateChangedCallback ? onConfirm;
63
+ final DateFormat ? format;
64
+ final DatePickerTheme ? theme;
62
65
final DateTime ? firstDate;
63
66
final DateTime ? lastDate;
64
- final bool alwaysUse24HourFormat;
65
- final DatePickerTheme ? theme;
66
- final DateChangedCallback ? onConfirm;
67
- final DateCancelledCallback ? onCancel;
67
+ final Locale ? locale;
68
68
69
69
FormBuilderCupertinoDateTimePicker ({
70
70
Key ? key,
71
71
//From Super
72
- required String name ,
73
- FormFieldValidator < DateTime > ? validator ,
72
+ AutovalidateMode autovalidateMode = AutovalidateMode .disabled ,
73
+ bool enabled = true ,
74
74
DateTime ? initialValue,
75
+ FocusNode ? focusNode,
76
+ FormFieldSetter <DateTime >? onSaved,
77
+ FormFieldValidator <DateTime >? validator,
75
78
InputDecoration decoration = const InputDecoration (),
79
+ required String name,
76
80
ValueChanged <DateTime ?>? onChanged,
77
81
ValueTransformer <DateTime ?>? valueTransformer,
78
- bool enabled = true ,
79
- FormFieldSetter <DateTime >? onSaved,
80
- AutovalidateMode autovalidateMode = AutovalidateMode .disabled,
81
82
VoidCallback ? onReset,
82
- FocusNode ? focusNode,
83
83
//
84
- this .locale,
84
+ this .alwaysUse24HourFormat = false ,
85
+ this .firstDate,
85
86
this .format,
86
87
this .inputType = CupertinoDateTimePickerInputType .both,
87
- this .firstDate,
88
88
this .lastDate,
89
- this .alwaysUse24HourFormat = false ,
90
- this .theme,
91
- this .onConfirm,
89
+ this .locale,
92
90
this .onCancel,
91
+ this .onConfirm,
92
+ this .theme,
93
93
94
94
//TextField options
95
- this .onFieldSubmitted,
95
+ this .autocorrect = false ,
96
+ this .autofocus = false ,
97
+ this .buildCounter,
96
98
this .controller,
99
+ this .cursorColor,
100
+ this .cursorRadius,
101
+ this .cursorWidth = 2.0 ,
102
+ this .enableInteractiveSelection = false ,
103
+ this .expands = false ,
104
+ this .inputFormatters,
105
+ this .keyboardAppearance,
97
106
this .keyboardType = TextInputType .datetime,
98
- this .style,
99
- this .textAlign = TextAlign .start,
100
- this .autofocus = false ,
101
- this .obscureText = false ,
102
- this .autocorrect = false ,
107
+ this .maxLength,
103
108
this .maxLengthEnforcement = MaxLengthEnforcement .none,
104
- this .textDirection,
105
109
this .maxLines,
106
- this .maxLength,
107
- this .inputFormatters,
108
- this .strutStyle = StrutStyle .disabled,
109
- this .transitionBuilder,
110
- this .showCursor = false ,
111
110
this .minLines,
112
- this .expands = false ,
113
- this .textInputAction,
111
+ this .obscureText = false ,
114
112
this .onEditingComplete,
115
- this .buildCounter,
116
- this .cursorRadius,
117
- this .cursorColor,
118
- this .keyboardAppearance,
113
+ this .onFieldSubmitted,
119
114
this .scrollPadding = const EdgeInsets .all (20.0 ),
120
- this .enableInteractiveSelection = false ,
121
- this .cursorWidth = 2.0 ,
115
+ this .showCursor = false ,
116
+ this .strutStyle = StrutStyle .disabled,
117
+ this .style,
118
+ this .textAlign = TextAlign .start,
122
119
this .textCapitalization = TextCapitalization .none,
120
+ this .textDirection,
121
+ this .textInputAction,
122
+ this .transitionBuilder,
123
123
}) : super (
124
- key: key,
124
+ autovalidateMode: autovalidateMode,
125
+ decoration: decoration,
126
+ enabled: enabled,
127
+ focusNode: focusNode,
125
128
initialValue: initialValue,
129
+ key: key,
126
130
name: name,
127
- validator: validator,
128
- valueTransformer: valueTransformer,
129
131
onChanged: onChanged,
130
- autovalidateMode: autovalidateMode,
131
- onSaved: onSaved,
132
- enabled: enabled,
133
132
onReset: onReset,
134
- decoration: decoration,
135
- focusNode: focusNode,
133
+ onSaved: onSaved,
134
+ validator: validator,
135
+ valueTransformer: valueTransformer,
136
136
builder: (FormFieldState <DateTime ?> field) {
137
137
final state = field as _FormBuilderCupertinoDateTimePickerState ;
138
138
139
139
return TextField (
140
- textDirection: textDirection,
141
- textAlign: textAlign,
142
- maxLength: maxLength,
140
+ autocorrect: autocorrect,
143
141
autofocus: autofocus,
142
+ buildCounter: buildCounter,
143
+ controller: state._textFieldController,
144
+ cursorColor: cursorColor,
145
+ cursorRadius: cursorRadius,
146
+ cursorWidth: cursorWidth,
144
147
decoration: state.decoration,
145
- readOnly: true ,
146
148
enabled: state.enabled,
147
- autocorrect : autocorrect ,
148
- controller : state._textFieldController ,
149
+ enableInteractiveSelection : enableInteractiveSelection ,
150
+ expands : expands ,
149
151
focusNode: state.effectiveFocusNode,
150
152
inputFormatters: inputFormatters,
153
+ keyboardAppearance: keyboardAppearance,
151
154
keyboardType: keyboardType,
155
+ maxLength: maxLength,
156
+ maxLengthEnforcement: maxLengthEnforcement,
152
157
maxLines: maxLines,
153
- obscureText: obscureText,
154
- showCursor: showCursor,
155
158
minLines: minLines,
156
- expands: expands,
157
- style: style,
159
+ obscureText: obscureText,
158
160
onEditingComplete: onEditingComplete,
159
- buildCounter: buildCounter,
160
- cursorColor: cursorColor,
161
- cursorRadius: cursorRadius,
162
- cursorWidth: cursorWidth,
163
- enableInteractiveSelection: enableInteractiveSelection,
164
- keyboardAppearance: keyboardAppearance,
161
+ readOnly: true ,
165
162
scrollPadding: scrollPadding,
163
+ showCursor: showCursor,
166
164
strutStyle: strutStyle,
165
+ style: style,
166
+ textAlign: textAlign,
167
167
textCapitalization: textCapitalization,
168
+ textDirection: textDirection,
168
169
textInputAction: textInputAction,
169
- maxLengthEnforcement: maxLengthEnforcement,
170
170
);
171
171
},
172
172
);
@@ -187,9 +187,9 @@ class _FormBuilderCupertinoDateTimePickerState extends FormBuilderFieldState<
187
187
super .initState ();
188
188
_textFieldController = widget.controller ?? TextEditingController ();
189
189
_dateFormat = widget.format ?? _getDefaultDateTimeFormat ();
190
- final initVal = initialValue;
190
+ final _initialValue = initialValue;
191
191
_textFieldController.text =
192
- initVal == null ? '' : _dateFormat.format (initVal );
192
+ _initialValue == null ? '' : _dateFormat.format (_initialValue );
193
193
effectiveFocusNode.addListener (_handleFocus);
194
194
}
195
195
0 commit comments