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. required DateTime firstDate,
  14. required DateTime lastDate,
  15. DateFormat? format,
  16. int maxLines = 1,
  17. bool obscureText = false,
  18. TextCapitalization textCapitalization = TextCapitalization.none,
  19. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  20. bool enableInteractiveSelection = true,
  21. MaxLengthEnforcement? maxLengthEnforcement,
  22. TextAlign textAlign = TextAlign.start,
  23. bool autofocus = false,
  24. bool autocorrect = true,
  25. double cursorWidth = 2.0,
  26. TextInputType? keyboardType,
  27. TextStyle? style,
  28. TextEditingController? controller,
  29. TextInputAction? textInputAction,
  30. StrutStyle? strutStyle,
  31. TextDirection? textDirection,
  32. int? maxLength,
  33. VoidCallback? onEditingComplete,
  34. ValueChanged<DateTimeRange?>? onFieldSubmitted,
  35. List<TextInputFormatter>? inputFormatters,
  36. Radius? cursorRadius,
  37. Color? cursorColor,
  38. Brightness? keyboardAppearance,
  39. InputCounterWidgetBuilder? buildCounter,
  40. bool expands = false,
  41. int? minLines,
  42. bool showCursor = false,
  43. Locale? locale,
  44. String? cancelText,
  45. String? confirmText,
  46. DateTime? currentDate,
  47. String? errorFormatText,
  48. Widget pickerBuilder(
    1. BuildContext,
    2. Widget?
    )?,
  49. String? errorInvalidRangeText,
  50. String? errorInvalidText,
  51. String? fieldEndHintText,
  52. String? fieldEndLabelText,
  53. String? fieldStartHintText,
  54. String? fieldStartLabelText,
  55. String? helpText,
  56. DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
  57. RouteSettings? routeSettings,
  58. String? saveText,
  59. bool useRootNavigator = true,
})

Creates field for selecting a range of dates

Implementation

FormBuilderDateRangePicker({
  Key? key,
  //From Super
  required String name,
  FormFieldValidator<DateTimeRange>? validator,
  DateTimeRange? initialValue,
  InputDecoration decoration = const InputDecoration(),
  ValueChanged<DateTimeRange?>? onChanged,
  ValueTransformer<DateTimeRange?>? valueTransformer,
  bool enabled = true,
  FormFieldSetter<DateTimeRange>? onSaved,
  AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
  VoidCallback? onReset,
  FocusNode? focusNode,
  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.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.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.initialDateRange,
  this.initialEntryMode = DatePickerEntryMode.calendar,
  this.routeSettings,
  this.saveText,
  this.useRootNavigator = true,
}) : super(
        key: key,
        initialValue: initialValue,
        name: name,
        validator: validator,
        valueTransformer: valueTransformer,
        onChanged: onChanged,
        autovalidateMode: autovalidateMode,
        onSaved: onSaved,
        enabled: enabled,
        onReset: onReset,
        decoration: decoration,
        focusNode: focusNode,
        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,
            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,
            strutStyle: strutStyle,
            readOnly: true,
            expands: expands,
            minLines: minLines,
            showCursor: showCursor,
          );
        },
      );