FormBuilderDateRangePicker constructor

FormBuilderDateRangePicker({
  1. Key? key,
  2. required String name,
  3. FormFieldValidator<DateTimeRange>? validator,
  4. DateTimeRange? initialValue,
  5. InputDecoration decoration = const InputDecoration(),
  6. ValueChanged<DateTimeRange?>? onChanged,
  7. ValueTransformer<DateTimeRange?>? valueTransformer,
  8. bool enabled = true,
  9. FormFieldSetter<DateTimeRange>? onSaved,
  10. AutovalidateMode? autovalidateMode = AutovalidateMode.disabled,
  11. VoidCallback? onReset,
  12. FocusNode? focusNode,
  13. String? restorationId,
  14. required DateTime firstDate,
  15. required DateTime lastDate,
  16. DateFormat? format,
  17. int maxLines = 1,
  18. bool obscureText = false,
  19. TextCapitalization textCapitalization = TextCapitalization.none,
  20. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  21. bool enableInteractiveSelection = true,
  22. MaxLengthEnforcement? maxLengthEnforcement,
  23. TextAlign textAlign = TextAlign.start,
  24. TextAlignVertical? textAlignVertical,
  25. bool autofocus = false,
  26. bool autocorrect = true,
  27. double cursorWidth = 2.0,
  28. TextInputType? keyboardType,
  29. TextStyle? style,
  30. TextEditingController? controller,
  31. TextInputAction? textInputAction,
  32. StrutStyle? strutStyle,
  33. TextDirection? textDirection,
  34. int? maxLength,
  35. VoidCallback? onEditingComplete,
  36. ValueChanged<DateTimeRange?>? onFieldSubmitted,
  37. List<TextInputFormatter>? inputFormatters,
  38. Radius? cursorRadius,
  39. Color? cursorColor,
  40. Brightness? keyboardAppearance,
  41. InputCounterWidgetBuilder? buildCounter,
  42. MouseCursor? mouseCursor,
  43. bool expands = false,
  44. int? minLines,
  45. bool showCursor = false,
  46. Locale? locale,
  47. String? cancelText,
  48. String? confirmText,
  49. DateTime? currentDate,
  50. String? errorFormatText,
  51. Widget pickerBuilder(
    1. BuildContext,
    2. Widget?
    )?,
  52. String? errorInvalidRangeText,
  53. String? errorInvalidText,
  54. String? fieldEndHintText,
  55. String? fieldEndLabelText,
  56. String? fieldStartHintText,
  57. String? fieldStartLabelText,
  58. String? helpText,
  59. DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
  60. RouteSettings? routeSettings,
  61. String? saveText,
  62. bool useRootNavigator = true,
  63. bool allowClear = false,
  64. Widget? clearIcon,
})

Creates field for selecting a range of dates

Implementation

FormBuilderDateRangePicker({
  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,
  required this.firstDate,
  required this.lastDate,
  this.format,
  this.maxLines = 1,
  this.obscureText = false,
  this.textCapitalization = TextCapitalization.none,
  this.scrollPadding = const EdgeInsets.all(20.0),
  this.enableInteractiveSelection = true,
  this.maxLengthEnforcement,
  this.textAlign = TextAlign.start,
  this.textAlignVertical,
  this.autofocus = false,
  this.autocorrect = true,
  this.cursorWidth = 2.0,
  this.keyboardType,
  this.style,
  this.controller,
  this.textInputAction,
  this.strutStyle,
  this.textDirection,
  this.maxLength,
  this.onEditingComplete,
  this.onFieldSubmitted,
  this.inputFormatters,
  this.cursorRadius,
  this.cursorColor,
  this.keyboardAppearance,
  this.buildCounter,
  this.mouseCursor,
  this.expands = false,
  this.minLines,
  this.showCursor = false,
  this.locale,
  this.cancelText,
  this.confirmText,
  this.currentDate,
  this.errorFormatText,
  this.pickerBuilder,
  this.errorInvalidRangeText,
  this.errorInvalidText,
  this.fieldEndHintText,
  this.fieldEndLabelText,
  this.fieldStartHintText,
  this.fieldStartLabelText,
  this.helpText,
  this.initialEntryMode = DatePickerEntryMode.calendar,
  this.routeSettings,
  this.saveText,
  this.useRootNavigator = true,
  this.allowClear = false,
  this.clearIcon,
}) : super(
        builder: (FormFieldState<DateTimeRange?> field) {
          final state = field as _FormBuilderDateRangePickerState;

          return TextField(
            enabled: state.enabled,
            style: style,
            focusNode: state.effectiveFocusNode,
            decoration: state.decoration,
            // initialValue: "${_initialValue ?? ''}",
            maxLines: maxLines,
            keyboardType: keyboardType,
            obscureText: obscureText,
            onEditingComplete: onEditingComplete,
            controller: state._effectiveController,
            autocorrect: autocorrect,
            autofocus: autofocus,
            buildCounter: buildCounter,
            mouseCursor: mouseCursor,
            cursorColor: cursorColor,
            cursorRadius: cursorRadius,
            cursorWidth: cursorWidth,
            enableInteractiveSelection: enableInteractiveSelection,
            maxLength: maxLength,
            inputFormatters: inputFormatters,
            keyboardAppearance: keyboardAppearance,
            maxLengthEnforcement: maxLengthEnforcement,
            scrollPadding: scrollPadding,
            textAlign: textAlign,
            textCapitalization: textCapitalization,
            textDirection: textDirection,
            textInputAction: textInputAction,
            textAlignVertical: textAlignVertical,
            strutStyle: strutStyle,
            readOnly: true,
            expands: expands,
            minLines: minLines,
            showCursor: showCursor,
          );
        },
      );