FormBuilderDateTimePicker constructor

FormBuilderDateTimePicker({
  1. Key? key,
  2. required String name,
  3. FormFieldValidator<DateTime>? validator,
  4. DateTime? initialValue,
  5. InputDecoration decoration = const InputDecoration(),
  6. ValueChanged<DateTime?>? onChanged,
  7. ValueTransformer<DateTime?>? valueTransformer,
  8. bool enabled = true,
  9. FormFieldSetter<DateTime>? onSaved,
  10. AutovalidateMode? autovalidateMode = AutovalidateMode.disabled,
  11. VoidCallback? onReset,
  12. FocusNode? focusNode,
  13. String? restorationId,
  14. FormFieldErrorBuilder? errorBuilder,
  15. InputType inputType = InputType.both,
  16. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  17. double cursorWidth = 2.0,
  18. bool enableInteractiveSelection = true,
  19. TimeOfDay initialTime = const TimeOfDay(hour: 12, minute: 0),
  20. TextInputType? keyboardType,
  21. TextAlign textAlign = TextAlign.start,
  22. bool autofocus = false,
  23. bool obscureText = false,
  24. bool autocorrect = true,
  25. int? maxLines = 1,
  26. bool expands = false,
  27. DatePickerMode initialDatePickerMode = DatePickerMode.day,
  28. TransitionBuilder? transitionBuilder,
  29. TextCapitalization textCapitalization = TextCapitalization.none,
  30. bool useRootNavigator = true,
  31. DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
  32. TimePickerEntryMode timePickerInitialEntryMode = TimePickerEntryMode.dial,
  33. DateFormat? format,
  34. DateTime? initialDate,
  35. DateTime? firstDate,
  36. DateTime? lastDate,
  37. DateTime? currentDate,
  38. Locale? locale,
  39. int? maxLength,
  40. TextDirection? textDirection,
  41. TextAlignVertical? textAlignVertical,
  42. ValueChanged<DateTime?>? onFieldSubmitted,
  43. TextEditingController? controller,
  44. TextStyle? style,
  45. MaxLengthEnforcement maxLengthEnforcement = MaxLengthEnforcement.none,
  46. List<TextInputFormatter>? inputFormatters,
  47. bool showCursor = false,
  48. int? minLines,
  49. TextInputAction? textInputAction,
  50. VoidCallback? onEditingComplete,
  51. InputCounterWidgetBuilder? buildCounter,
  52. MouseCursor? mouseCursor,
  53. Radius? cursorRadius,
  54. Color? cursorColor,
  55. Brightness? keyboardAppearance,
  56. String? cancelText,
  57. String? confirmText,
  58. String? errorFormatText,
  59. String? errorInvalidText,
  60. String? fieldHintText,
  61. String? fieldLabelText,
  62. String? helpText,
  63. RouteSettings? routeSettings,
  64. StrutStyle? strutStyle,
  65. SelectableDayPredicate? selectableDayPredicate,
  66. Offset? anchorPoint,
  67. EntryModeChangeCallback? onEntryModeChanged,
  68. bool disablePicker = false,
  69. bool barrierDismissible = true,
})

Creates field for Date, Time and DateTime input

Implementation

FormBuilderDateTimePicker({
  super.key,
  required super.name,
  super.validator,
  super.initialValue,
  super.decoration,
  super.onChanged,
  super.valueTransformer,
  super.enabled,
  super.onSaved,
  super.autovalidateMode = AutovalidateMode.disabled,
  super.onReset,
  super.focusNode,
  super.restorationId,
  super.errorBuilder,
  this.inputType = InputType.both,
  this.scrollPadding = const EdgeInsets.all(20.0),
  this.cursorWidth = 2.0,
  this.enableInteractiveSelection = true,
  this.initialTime = const TimeOfDay(hour: 12, minute: 0),
  this.keyboardType,
  this.textAlign = TextAlign.start,
  this.autofocus = false,
  this.obscureText = false,
  this.autocorrect = true,
  this.maxLines = 1,
  this.expands = false,
  this.initialDatePickerMode = DatePickerMode.day,
  this.transitionBuilder,
  this.textCapitalization = TextCapitalization.none,
  this.useRootNavigator = true,
  this.initialEntryMode = DatePickerEntryMode.calendar,
  this.timePickerInitialEntryMode = TimePickerEntryMode.dial,
  this.format,
  this.initialDate,
  this.firstDate,
  this.lastDate,
  this.currentDate,
  this.locale,
  this.maxLength,
  this.textDirection,
  this.textAlignVertical,
  this.onFieldSubmitted,
  this.controller,
  this.style,
  this.maxLengthEnforcement = MaxLengthEnforcement.none,
  this.inputFormatters,
  this.showCursor = false,
  this.minLines,
  this.textInputAction,
  this.onEditingComplete,
  this.buildCounter,
  this.mouseCursor,
  this.cursorRadius,
  this.cursorColor,
  this.keyboardAppearance,
  this.cancelText,
  this.confirmText,
  this.errorFormatText,
  this.errorInvalidText,
  this.fieldHintText,
  this.fieldLabelText,
  this.helpText,
  this.routeSettings,
  this.strutStyle,
  this.selectableDayPredicate,
  this.anchorPoint,
  this.onEntryModeChanged,
  this.disablePicker = false,
  this.barrierDismissible = true,
}) : super(
       builder: (FormFieldState<DateTime?> field) {
         final state = field as _FormBuilderDateTimePickerState;

         return FocusTraversalGroup(
           policy: ReadingOrderTraversalPolicy(),
           child: TextField(
             onTap: disablePicker ? null : () => state.showPicker(),
             textDirection: textDirection,
             textAlign: textAlign,
             textAlignVertical: textAlignVertical,
             maxLength: maxLength,
             autofocus: autofocus,
             decoration: state.decoration,
             readOnly: true,
             enabled: state.enabled,
             autocorrect: autocorrect,
             controller: state._textFieldController,
             focusNode: state.effectiveFocusNode,
             inputFormatters: inputFormatters,
             keyboardType: keyboardType,
             maxLines: maxLines,
             obscureText: obscureText,
             showCursor: showCursor,
             minLines: minLines,
             expands: expands,
             style: style,
             onEditingComplete: onEditingComplete,
             buildCounter: buildCounter,
             mouseCursor: mouseCursor,
             cursorColor: cursorColor,
             cursorRadius: cursorRadius,
             cursorWidth: cursorWidth,
             enableInteractiveSelection: enableInteractiveSelection,
             keyboardAppearance: keyboardAppearance,
             scrollPadding: scrollPadding,
             strutStyle: strutStyle,
             textCapitalization: textCapitalization,
             textInputAction: textInputAction,
             maxLengthEnforcement: maxLengthEnforcement,
           ),
         );
       },
     );