DesignDateField class
A date typed in segments, in the reader's order: value is a calendar day (its time ignored), null when empty; onChanged gets the day once every segment holds one, and null when one is cleared.
The segments follow DesignLocalizations.dateFieldPattern (month, day, year in English; day, month, year in German; year first in Japanese), the text between them the locale's. A day past the month's end moves back to its last day when the month or the year changes. Outside firstDate and lastDate the segments carry WidgetState.error, the field reads as invalid and says so (DesignLocalizations.dateOutOfRangeLabel), and the value still comes through.
Keys, on a segment (each a tab stop): digits type, Up and Down step it (wrapping 12 on to 1), Home and End its least and greatest, Backspace clears it and then moves back, Left and Right move as drawn, a typed separator moves on, Enter calls onEditingComplete.
DesignDateField(value: DateTime(2026, 11, 16), onChanged: (day) {}, segmentBuilder: (context, details) => Text(details.text))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DesignDateField
Constructors
-
DesignDateField({Key? key, required DateTime? value, required ValueChanged<
DateTime?> ? onChanged, required DesignDateSegmentBuilder segmentBuilder, DesignDateLiteralBuilder? literalBuilder, DesignDateFieldFrameBuilder? frameBuilder, DateTime? firstDate, DateTime? lastDate, String? semanticLabel, bool autofocus = false, VoidCallback? onEditingComplete}) -
A date field showing
value.const
Properties
- autofocus → bool
-
Whether the first segment takes focus when it first shows.
final
- firstDate → DateTime?
-
The first day in range; null: none before is out of range.
final
- frameBuilder → DesignDateFieldFrameBuilder?
-
Frames the laid-out segments; null: the segments alone.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- lastDate → DateTime?
-
The last day in range; null: none after is out of range.
final
- literalBuilder → DesignDateLiteralBuilder?
-
Paints the text between segments; null: a Text.
final
-
onChanged
→ ValueChanged<
DateTime?> ? -
Called with the day once every segment holds one, and with null when a
segment is cleared.
final
- onEditingComplete → VoidCallback?
-
Called on Enter (and a phone keyboard's Done), never on a submit:
a field commits as the web's Enter keeps typing.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- segmentBuilder → DesignDateSegmentBuilder
-
Paints a segment.
final
- semanticLabel → String?
-
What a screen reader calls the field ("Date of birth"); null: nothing.
final
- value → DateTime?
-
The day shown; null, empty.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DesignDateField> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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.
override
-
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, int wrapWidth = 65}) → 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