Skip to content

Commit 91bccb1

Browse files
refactor: update error handling in FormBuilderCupertinoDateTimePicker
1 parent a87cca9 commit 91bccb1

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

lib/src/fields/form_builder_cupertino_datetime_picker.dart

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,6 @@ class FormBuilderCupertinoDateTimePicker extends FormBuilderField<DateTime> {
189189
/// null, the row is shorter.
190190
final Widget? helper;
191191

192-
/// A builder widget that is displayed underneath the [prefix] and [child] widgets.
193-
///
194-
/// The [error] widget is primarily used to inform users of input errors. When
195-
/// a [Text] is given to [error], it will be shown in
196-
/// [CupertinoColors.destructiveRed] coloring and medium-weighted font. The
197-
/// row becomes taller in order to display the [helper] widget underneath
198-
/// [prefix] and [child]. If null, the row is shorter.
199-
final Widget? Function(String error)? errorBuilder;
200-
201192
/// Preset the widget's value.
202193
final bool autofocus;
203194
final bool obscureText;
@@ -255,6 +246,7 @@ class FormBuilderCupertinoDateTimePicker extends FormBuilderField<DateTime> {
255246
super.onReset,
256247
super.focusNode,
257248
super.restorationId,
249+
super.errorBuilder,
258250
this.inputType = InputType.both,
259251
this.scrollPadding = const EdgeInsets.all(20.0),
260252
this.cursorWidth = 2.0,
@@ -267,7 +259,6 @@ class FormBuilderCupertinoDateTimePicker extends FormBuilderField<DateTime> {
267259
this.prefix,
268260
this.contentPadding,
269261
this.helper,
270-
this.errorBuilder,
271262
this.autofocus = false,
272263
this.obscureText = false,
273264
this.autocorrect = true,
@@ -349,7 +340,7 @@ class FormBuilderCupertinoDateTimePicker extends FormBuilderField<DateTime> {
349340
return CupertinoFormRow(
350341
error: state.hasError
351342
? errorBuilder != null
352-
? errorBuilder(state.errorText ?? '')
343+
? errorBuilder(state.context, state.errorText ?? '')
353344
: Text(state.errorText ?? '')
354345
: null,
355346
helper: helper,

0 commit comments

Comments
 (0)