FTimeField class abstract

A time field allows a time to be selected from a picker or input field.

A FTimeField is internally a FormField, therefore it can be used in a Form.

It is recommended to use FTimeField.picker on touch devices and FTimeField.new on non-touch devices.

The input field supports both arrow key navigation:

  • Up/Down arrows: Increment/decrement values
  • Left/Right arrows: Move between time segments

The input field does not support the following locales that use non-western numerals & scripts that require composing, it will default to English:

  • Arabic (العربية)
  • Assamese (অসমীয়া)
  • Bengali (বাংলা)
  • Persian/Farsi (فارسی)
  • Marathi (मराठी)
  • Burmese (မြန်မာ)
  • Nepali (नेपाली)
  • Pashto (پښتو)
  • Tamil (தமிழ்)
  • Amharic (አማርኛ)
    • Kannada (ಕನ್ನಡ)
    • Korean (한국어)
    • Punjabi (ਪੰਜਾਬੀ)
    • Thai (ไทย)

The following locales will default to zh:

  • Chinese (Hong Kong) (繁體中文)
  • Chinese (Taiwan) (繁體中文)

Consider providing a FTimeFieldController.validator to perform custom time validation logic. By default, all times are valid.

See:

Inheritance

Constructors

FTimeField.new({FTimeFieldController? controller, FTimeFieldStyle? style, FTime? initialTime, bool hour24, bool autofocus, FocusNode? focusNode, ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)> builder, ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)>? prefixBuilder, ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)>? suffixBuilder, TextInputAction? textInputAction, TextAlign textAlign, TextAlignVertical? textAlignVertical, TextDirection? textDirection, bool expands, VoidCallback? onEditingComplete, ValueChanged<FTime>? onSubmit, MouseCursor? mouseCursor, bool canRequestFocus, Widget? label, Widget? description, bool enabled, ValueChanged<FTime?>? onChange, FormFieldSetter<FTime>? onSaved, AutovalidateMode autovalidateMode, String? forceErrorText, Widget errorBuilder(BuildContext, String), Key? key})
Creates a time field that wraps a text input field.
const
factory
FTimeField.picker({FTimeFieldController? controller, FTimeFieldStyle? style, FTime? initialTime, bool hour24, DateFormat? format, TextAlign textAlign, TextAlignVertical? textAlignVertical, TextDirection? textDirection, bool expands, MouseCursor mouseCursor, bool canRequestFocus, String? hint, bool autofocus, FocusNode? focusNode, Alignment anchor, Alignment inputAnchor, FPortalSpacing spacing, Offset shift(Size, FPortalChildBox, FPortalBox), Offset offset, FHidePopoverRegion hideOnTapOutside, int hourInterval, int minuteInterval, ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)> builder, ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)>? prefixBuilder, ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)>? suffixBuilder, Widget? label, Widget? description, bool enabled, ValueChanged<FTime?>? onChange, FormFieldSetter<FTime>? onSaved, AutovalidateMode autovalidateMode, String? forceErrorText, Widget errorBuilder(BuildContext, String), Key? key})
Creates a FTimeField that allows a time to be selected using only a picker.
const
factory

Properties

autofocus bool
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
autovalidateMode AutovalidateMode
Used to enable/disable this checkbox auto validation and update its error text.
final
builder ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)>
The builder used to decorate the time-field. It should use the given child.
final
controller FTimeFieldController?
The controller.
final
description Widget?
The description.
final
enabled bool
Whether the form is able to receive user input.
final
errorBuilder Widget Function(BuildContext, String)
The builder for errors displayed below the description. Defaults to displaying the error message.
final
focusNode FocusNode?
An optional focus node to use as the focus node for this widget.
final
forceErrorText String?
An optional property that forces the FormFieldState into an error state by directly setting the FormFieldState.errorText property without running the validator function.
final
hashCode int
The hash code for this object.
no setterinherited
hour24 bool
True if the time field should use the 24-hour format.
final
initialTime FTime?
The initial time.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label Widget?
The label.
final
onChange ValueChanged<FTime?>?
Handler called when the time changes.
final
onSaved FormFieldSetter<FTime>?
An optional method to call with the final value when the form is saved via FormState.save.
final
prefixBuilder ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)>?
Builds a widget at the start of the input field that can be pressed to toggle the popover. Defaults to defaultIconBuilder.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style FTimeFieldStyle?
The style.
final
suffixBuilder ValueWidgetBuilder<(FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>)>?
Builds a widget at the end of the input field that can be pressed to toggle the popover. Defaults to no suffix.
final

Methods

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

Static Methods

defaultIconBuilder(BuildContext _, (FTimeFieldStyle, FTextFieldStyle, Set<WidgetState>) styles, Widget? _) Widget
The default prefix builder that shows a clock icon.