FossTimePicker class Inputs

FossTimePicker, light theme FossTimePicker, dark theme

See the time picker documentation ↗ or try it live in the playground ↗.

A time field that opens scrolling wheels in a modal dialog and shows the chosen time back in its trigger.

The trigger is a full-width field with a leading clock glyph and the formatted time, or a placeholder while empty. Tapping it (or pressing Enter, Space, or the down arrow) opens the wheels as a modal, presented as a bottom sheet by default or a centered card via presentation. Drive the open state yourself with open plus onOpenChange, or leave it uncontrolled.

Where a wheel stops scrolling is not the same as a choice, so the modal keeps a draft and commits on the footer: confirmLabel reports through onChanged and closes, while cancelLabel and the barrier discard. Bound the selectable range with minTime, maxTime, and isTimeEnabled. A blocked time stays on the wheel rather than leaving a hole in it, dimmed, and the confirm action is disabled while the draft sits on one. minuteStep coarsens the minute column, and use24HourFormat swaps the period column for a 24-hour reading.

Colors, type, and metrics come from context.fossTheme; pass a FossTimePickerStyle 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.

See also FossTimeOfDay for the value type.

FossTimePicker(
  value: picked,
  onChanged: (time) => setState(() => picked = time),
);
Inheritance
Annotations

Constructors

FossTimePicker({required FossTimeOfDay? value, required ValueChanged<FossTimeOfDay> onChanged, String placeholder = 'Pick a time', String format(FossTimeOfDay)?, bool? use24HourFormat, int minuteStep = 1, FossTimeOfDay? minTime, FossTimeOfDay? maxTime, bool isTimeEnabled(FossTimeOfDay)?, bool? open, ValueChanged<bool>? onOpenChange, FossDialogPresentation presentation = FossDialogPresentation.bottomSheet, String confirmLabel = 'Set', String cancelLabel = 'Cancel', bool enabled = true, String? semanticsLabel, FossTimePickerStyle? style, Key? key})
FossTimePicker, light theme FossTimePicker, dark theme
const

Properties

cancelLabel String
Label of the footer action that discards the draft.
final
confirmLabel String
Label of the footer action that commits the draft.
final
enabled bool
Whether the trigger accepts input. When false it dims and never opens.
final
format String Function(FossTimeOfDay)?
Overrides the built-in trigger label, which is 9:30 AM or 21:30 depending on the resolved hour format.
final
hashCode int
The hash code for this object.
no setterinherited
isTimeEnabled bool Function(FossTimeOfDay)?
Blocks individual times on top of minTime and maxTime. Returning false dims the entry and disables the confirm action while the draft rests on it.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxTime FossTimeOfDay?
The latest selectable time, inclusive.
final
minTime FossTimeOfDay?
The earliest selectable time, inclusive.
final
minuteStep int
The minute increment the wheel offers. Must divide 60 evenly; defaults to
final
onChanged ValueChanged<FossTimeOfDay>
Called with the draft when the footer confirms. Never fires on a scroll.
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, and used as the modal title.
final
presentation FossDialogPresentation
How the modal 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 FossTimePickerStyle?
Per-instance overrides layered on the theme-resolved style.
final
use24HourFormat bool?
Whether to read and pick on a 24-hour clock, which drops the period column. Null follows the platform setting through MediaQuery, falling back to 12-hour.
final
value FossTimeOfDay?
The committed time, or null for none.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<FossTimePicker>
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