DateRangeField class

A DateRangeField which extends a FormField.

The use of a Form ancestor is not required, however it makes it easier to save, reset, and validate multiple fields at the same time. In order to use this without a Form ancestor, pass a GlobalKey to the constructor and use GlobalKey.currentState the same way as you would for a form.

To style this widget, pass an InputDecoration to the constructor. If not, the DateRangeField will use the default from the Theme.

This widget must have a Material ancestor, such as a MaterialApp or Form.

Inheritance

Constructors

DateRangeField({Key? key, DateTime? firstDate, DateTime? lastDate, DateTime? currentDate, DatePickerEntryMode? initialEntryMode, String? helpText, String? cancelText, bool enabled = true, String? confirmText, String? saveText, String? errorFormatText, String? errorInvalidText, String? errorInvalidRangeText, String? fieldStartHintText, String? fieldEndHintText, String? fieldStartLabelText, String? fieldEndLabelText, double? width, EdgeInsets? margin, ValueChanged<DateTimeRange?>? onChanged, FormFieldSetter<DateTimeRange>? onSaved, FormFieldValidator<DateTimeRange>? validator, DateTimeRange? initialValue, bool autoValidate = false, DateFormat? dateFormat, InputDecoration decoration = const InputDecoration()})
Creates a DateRangeField which extends a FormField.

Properties

autovalidateMode AutovalidateMode
Used to enable/disable this form field auto validation and update its error text.
finalinherited
builder FormFieldBuilder<DateTimeRange>
Function that returns the widget representing this form field. It is passed the form field state as input, containing the current value and validation state of this field.
finalinherited
cancelText String?
This is the label on the cancel button for the text input mode.
final
confirmText String?
This is the label on the ok button for the text input mode.
final
currentDate DateTime?
currentDate represents the the current day (today).
final
dateFormat → DateFormat?
This is the format the widget will use for dates.
final
enabled bool
Whether input should be enabled.
final
errorFormatText String?
This is the error message displayed when the input text is not a proper date format.
final
errorInvalidRangeText String?
This is the error message displayed when an input is not a valid date range.
final
errorInvalidText String?
This is the error message displayed when an input is not a selectable date.
final
fieldEndHintText String?
This is the text used to prompt the user when no text has been entered in the end field.
final
fieldEndLabelText String?
This is the label for the end date input text field.
final
fieldStartHintText String?
This is the text used to prompt the user when no text has been entered in the start field.
final
fieldStartLabelText String?
This is the label for the start date input text field.
final
firstDate DateTime?
This is the earliest date a user can select.
final
hashCode int
The hash code for this object.
no setterinherited
helpText String?
This is the label displayed at the top of the showDateRangePicker dialog.
final
initialEntryMode DatePickerEntryMode?
This argument determines which mode the showDateRangePicker will initially display in.
final
initialValue DateTimeRange?
This required field is the initial DateTimeRange value of the widget.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lastDate DateTime?
This is the latest date a user can select.
final
margin EdgeInsets?
This is the margins of the widget.
final
onSaved FormFieldSetter<DateTimeRange>?
An optional method to call with the final value when the form is saved via FormState.save.
finalinherited
restorationId String?
Restoration ID to save and restore the state of the form field.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
saveText String?
This is the label on the save button for the calendar view.
final
validator FormFieldValidator<DateTimeRange>?
An optional method that validates an input. Returns an error string to display if the input is invalid, or null otherwise.
finalinherited
width double?
This is the width of the widget.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() FormFieldState<DateTimeRange>
Creates the mutable state for this widget at a given location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited