UiTimePicker class

Simple hour/minute wheel picker (24-hour clock).

Uses two ListWheelScrollViews for the hour and minute columns. Disabled minute/hour values are skipped by the predicate hook.

Performance notes (PR-D)

The active-item styling for each wheel is driven by a ValueNotifier<int> that the ListWheelScrollView updates on every onSelectedItemChanged. The item builder listens via ValueListenableBuilder, so only the one or two row widgets whose active/inactive state just changed rebuild — the parent picker does not setState on every wheel tick. Previously a fling ran through _UiTimePickerState.setState for every snapped index, which in turn rebuilt the outer UiBox + both wheel subtrees on every frame of the fling deceleration. That was the visible "scrolling lag" on low-powered Android devices: the minute column was rebuilding 30–40 times during a normal fling even though its structure hadn't changed.

onChanged is still invoked once per snapped index so external listeners (form state, other pickers) see the full stream of intermediate values during a fling, unchanged from before.

Inheritance
Annotations
  • @Deprecated('Use UiTimeGridPicker for inline picker surfaces or UiTimePickerField for ' 'form fields. The wheel picker will remain available through the next minor ' 'release for migration.')

Constructors

UiTimePicker({Key? key, UiTimeValue? value, ValueChanged<UiTimeValue>? onChanged, int minuteStep = 1, bool hourDisabled(int hour)?, String? semanticsPrefix})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
hourDisabled bool Function(int hour)?
Returns true for hours (0..23) that cannot be chosen.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minuteStep int
final
onChanged ValueChanged<UiTimeValue>?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsPrefix String?
Optional spoken prefix applied to wheel-row semantics labels.
final
value UiTimeValue?
final

Methods

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