FormBuilderDateRangePicker constructor
FormBuilderDateRangePicker({
- Key? key,
- 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 DateTime firstDate,
- required DateTime lastDate,
- DateFormat? format,
- int maxLines = 1,
- bool obscureText = false,
- TextCapitalization textCapitalization = TextCapitalization.none,
- EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
- bool enableInteractiveSelection = true,
- MaxLengthEnforcement? maxLengthEnforcement,
- TextAlign textAlign = TextAlign.start,
- TextAlignVertical? textAlignVertical,
- bool autofocus = false,
- bool autocorrect = true,
- double cursorWidth = 2.0,
- TextInputType? keyboardType,
- TextStyle? style,
- TextEditingController? controller,
- TextInputAction? textInputAction,
- StrutStyle? strutStyle,
- TextDirection? textDirection,
- int? maxLength,
- VoidCallback? onEditingComplete,
- ValueChanged<
DateTimeRange?> ? onFieldSubmitted, - List<
TextInputFormatter> ? inputFormatters, - Radius? cursorRadius,
- Color? cursorColor,
- Brightness? keyboardAppearance,
- InputCounterWidgetBuilder? buildCounter,
- bool expands = false,
- int? minLines,
- bool showCursor = false,
- Locale? locale,
- String? cancelText,
- String? confirmText,
- DateTime? currentDate,
- String? errorFormatText,
- Widget pickerBuilder()?,
- String? errorInvalidRangeText,
- String? errorInvalidText,
- String? fieldEndHintText,
- String? fieldEndLabelText,
- String? fieldStartHintText,
- String? fieldStartLabelText,
- String? helpText,
- DatePickerEntryMode initialEntryMode = DatePickerEntryMode.calendar,
- RouteSettings? routeSettings,
- String? saveText,
- bool allowClear = false,
- 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,
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.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,
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,
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,
);
},
);