FossDatePicker class Inputs

See the date picker documentation ↗ or try it live in the playground ↗.
A date field that opens a calendar in a modal dialog and shows the chosen date back in its trigger.
Pick a mode with the named constructors, each typing its selection so the
value is never dynamic:
- FossDatePicker.single holds one DateTime.
- FossDatePicker.range holds a FossDateRange over two taps.
The trigger is a full-width field with a leading calendar glyph and the
formatted date, or a placeholder while empty. Tapping it (or pressing
Enter, Space, or the down arrow) opens the calendar as a modal, presented as
a bottom sheet by default or a centered card via presentation. Picking a
date reports it through onSelected; a single pick closes the dialog, a
range closes once both ends are set, both governed by closeOnSelect. Drive
the open state yourself with open plus onOpenChange, or leave it
uncontrolled.
Bound and navigate the calendar through minDate, maxDate,
isDateEnabled, and firstDayOfWeek. Supply a format callback for a
locale-aware label; the built-in default takes no date-library dependency.
Colors, type, and metrics come from context.fossTheme; pass a
FossDatePickerStyle to style for a one-off.
Customize globally by passing your own FossThemeData, or per instance
through the widget's style object. There are no per-instance token props:
to change color, radius, or spacing, change the theme.
FossDatePicker.single(
selected: picked,
onSelected: (day) => setState(() => picked = day),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FossDatePicker
- Annotations
-
- @FossSince('0.1.1')
Constructors
-
FossDatePicker.range({required FossDateRange? selected, required ValueChanged<
FossDateRange> onSelected, String format(FossDateRange)?, String placeholder = 'Pick a date range', bool? open, ValueChanged<bool> ? onOpenChange, bool closeOnSelect = true, FossDialogPresentation presentation = FossDialogPresentation.bottomSheet, int firstDayOfWeek = DateTime.monday, DateTime? minDate, DateTime? maxDate, bool isDateEnabled(DateTime)?, bool enabled = true, String? semanticsLabel, FossDatePickerStyle? style, Key? key}) -
Creates a range picker.
selectedis the chosen span (null for none);onSelectedfires as the range is set over two taps.formatoverrides the built-inJul 09, 2026 - Jul 16, 2026label.const -
FossDatePicker.single({required DateTime? selected, required ValueChanged<
DateTime> onSelected, String format(DateTime)?, String placeholder = 'Pick a date', bool? open, ValueChanged<bool> ? onOpenChange, bool closeOnSelect = true, FossDialogPresentation presentation = FossDialogPresentation.bottomSheet, int firstDayOfWeek = DateTime.monday, DateTime? minDate, DateTime? maxDate, bool isDateEnabled(DateTime)?, bool enabled = true, String? semanticsLabel, FossDatePickerStyle? style, Key? key}) -
const
Properties
- closeOnSelect → bool
-
Whether a completed pick closes the dialog: a single pick, or the second
tap of a range. Defaults to true. Set false to keep it open.
final
- enabled → bool
-
Whether the trigger accepts input. When false it dims and never opens.
final
- firstDayOfWeek → int
-
The leading weekday column, as a DateTime weekday (1 = Monday), passed
to the calendar.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDateEnabled → bool Function(DateTime)?
-
Disables individual days on top of minDate and maxDate. Passed to the
calendar.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxDate → DateTime?
-
The latest selectable and navigable day, inclusive. Passed to the
calendar.
final
- minDate → DateTime?
-
The earliest selectable and navigable day, inclusive. Passed to the
calendar.
final
-
onOpenChange
→ ValueChanged<
bool> ? -
Called with the requested open state on every open or close, including
dismissals. Required to observe changes in controlled mode.
final
- open → bool?
-
The controlled open state. Non-null puts the dialog in controlled mode:
pair it with onOpenChange and rebuild on change. Null is uncontrolled.
final
- placeholder → String
-
Shown in the trigger while nothing is selected.
final
- presentation → FossDialogPresentation
-
How the calendar dialog presents: a bottom sheet (default) or a centered
card.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsLabel → String?
-
Accessibility name for the trigger.
final
- style → FossDatePickerStyle?
-
Per-instance overrides layered on the theme-resolved style.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< FossDatePicker> -
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.
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, 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