TimeField class

A time field (HH:MM AM, or HH:MM when use24Hour is true) that opens a TimeWheel popover when tapped anywhere.

The field never accepts typed text. The wheels update the field live and report through onChanged; the popover closes when the user taps outside it or presses Escape. It also works without value, keeping the picked time itself. minValue/maxValue compare the time of day only and feed the built-in validator, so minValue must not be after maxValue. isRequired appends a red marker to a Text label.

TimeField(
  value: alarm,
  minuteInterval: 5,
  onChanged: (t) => setState(() => alarm = t),
)
Inheritance
Implementers

Constructors

TimeField({Key? key, DateTime? value, ValueChanged<DateTime>? onChanged, Widget? label, Widget? description, Widget? errorMessage, Widget? prefix, Widget? suffix, bool isInvalid = false, bool isRequired = false, bool disabled = false, bool fullWidth = false, bool use24Hour = false, int minuteInterval = 1, DateTime? minValue, DateTime? maxValue, FieldVariant? variant, FormFieldValidator<DateTime>? validator, FormFieldSetter<DateTime>? onSaved, FormFieldErrorBuilder? errorBuilder, String? forceErrorText, VoidCallback? onReset, AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction})
Creates a TimeField.
const

Properties

autovalidateMode → AutovalidateMode
When the validator runs without being asked.
final
description → Widget?
Helper text shown below the field.
final
disabled → bool
Disables the field.
final
errorBuilder → FormFieldErrorBuilder?
Builds the widget that shows the validator's error text.
final
errorMessage → Widget?
Error text shown below the field while it is invalid.
final
forceErrorText → String?
Error text that is shown whatever the validator returns.
final
fullWidth → bool
Whether the field stretches to the full available width.
final
hashCode → int
The hash code for this object.
no setterinherited
isInvalid → bool
Whether the field is drawn in its invalid state.
final
isRequired → bool
Appends a red marker to the label when the label is a Text.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → Widget?
Label shown above the field.
final
maxValue → DateTime?
Latest valid time of day.
final
minuteInterval → int
Step between the minutes on the minute wheel. Must divide 60 evenly.
final
minValue → DateTime?
Earliest valid time of day.
final
onChanged → ValueChanged<DateTime>?
Called with the time the wheels settle on.
final
onReset → VoidCallback?
Called when the enclosing form resets.
final
onSaved → FormFieldSetter<DateTime>?
Called with the field's value when the enclosing form saves.
final
prefix → Widget?
Widget shown before the field's content.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
suffix → Widget?
Widget shown after the field's content. Defaults to a clock icon.
final
use24Hour → bool
Whether the time uses a 24-hour clock without an AM/PM wheel.
final
validator → FormFieldValidator<DateTime>?
Returns an error message when the time is invalid, or null when it is valid. It runs when the form validates and as autovalidateMode directs.
final
value → DateTime?
The time shown in the field.
final
variant → FieldVariant?
Visual style of the field. Defaults to FieldDefaults.variant, then FieldVariant.outline.
final

Methods

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