ShadTimePicker class

A customizable time picker component with hour, minute, and second inputs.

Supports different variants, layouts, and extensive styling options.

Inheritance
Available extensions

Constructors

ShadTimePicker({Key? key, Axis? axis, double? spacing, double? runSpacing, bool? jumpToNextFieldWhenFilled, ValueChanged<ShadTimeOfDay>? onChanged, ShadTimeOfDay? initialValue, Widget? hourLabel, Widget? minuteLabel, Widget? secondLabel, Widget? hourPlaceholder, Widget? minutePlaceholder, Widget? secondPlaceholder, Widget? leading, Widget? trailing, WrapAlignment? alignment, WrapAlignment? runAlignment, WrapCrossAlignment? crossAxisAlignment, int maxHour = 23, int maxMinute = 59, int maxSecond = 59, int minHour = 0, int minMinute = 0, int minSecond = 0, double? gap, TextStyle? style, TextStyle? labelStyle, TextStyle? placeholderStyle, double? fieldWidth, EdgeInsetsGeometry? fieldPadding, ShadDecoration? fieldDecoration, ShadTimePickerController? controller, bool enabled = true, WidgetBuilder? keyboardToolbarBuilder, bool? showHours, bool? showSeconds, bool? showMinutes})
Creates a ShadTimePicker with the primary variant (24-hour format).
const
ShadTimePicker.period({Key? key, Axis? axis, double? spacing, double? runSpacing, bool? jumpToNextFieldWhenFilled, ValueChanged<ShadTimeOfDay>? onChanged, ShadTimeOfDay? initialValue, Widget? hourLabel, Widget? minuteLabel, Widget? secondLabel, Widget? hourPlaceholder, Widget? minutePlaceholder, Widget? secondPlaceholder, Widget? leading, Widget? trailing, WrapAlignment? alignment, WrapAlignment? runAlignment, WrapCrossAlignment? crossAxisAlignment, int maxHour = 12, int maxMinute = 59, int maxSecond = 59, int minHour = 0, int minMinute = 0, int minSecond = 0, ShadDayPeriod? initialDayPeriod, Widget? periodLabel, Widget? periodPlaceholder, double? periodHeight, double? periodMinWidth, double? gap, TextStyle? style, TextStyle? labelStyle, TextStyle? placeholderStyle, double? fieldWidth, EdgeInsetsGeometry? fieldPadding, ShadDecoration? fieldDecoration, ShadDecoration? periodDecoration, ShadTimePickerController? controller, bool enabled = true, WidgetBuilder? keyboardToolbarBuilder, bool? showHours, bool? showMinutes, bool? showSeconds})
Creates a ShadTimePicker with the period variant (12-hour format with AM/PM).
const
ShadTimePicker.raw({Key? key, required ShadTimePickerVariant variant, Axis? axis, double? spacing, double? runSpacing, bool? jumpToNextFieldWhenFilled, ValueChanged<ShadTimeOfDay>? onChanged, ShadTimeOfDay? initialValue, Widget? hourLabel, Widget? minuteLabel, Widget? secondLabel, Widget? hourPlaceholder, Widget? minutePlaceholder, Widget? secondPlaceholder, Widget? leading, Widget? trailing, WrapAlignment? alignment, WrapAlignment? runAlignment, WrapCrossAlignment? crossAxisAlignment, int maxHour = 23, int maxMinute = 59, int maxSecond = 59, int minHour = 0, int minMinute = 0, int minSecond = 0, ShadDayPeriod? initialDayPeriod, Widget? periodLabel, Widget? periodPlaceholder, double? periodHeight, double? periodMinWidth, double? gap, TextStyle? style, TextStyle? labelStyle, TextStyle? placeholderStyle, double? fieldWidth, EdgeInsetsGeometry? fieldPadding, ShadDecoration? fieldDecoration, ShadDecoration? periodDecoration, ShadTimePickerController? controller, bool enabled = true, WidgetBuilder? keyboardToolbarBuilder, bool? showHours, bool? showMinutes, bool? showSeconds})
Creates a ShadTimePicker with a raw variant, allowing explicit variant specification.
const

Properties

alignment WrapAlignment?
The alignment of the fields in the picker. Defaults to WrapAlignment.center.
final
axis Axis?
The axis along which the fields are laid out. Defaults to horizontal.
final
controller ShadTimePickerController?
The controller of the time picker, defaults to null.
final
crossAxisAlignment WrapCrossAlignment?
The alignment of the fields in the picker. Defaults to WrapCrossAlignment.center.
final
enabled bool
Whether the time picker is enabled, defaults to true.
final
fieldDecoration ShadDecoration?
The decoration of the field, defaults to
final
fieldPadding EdgeInsetsGeometry?
The padding of the field, defaults to const EdgeInsets.symmetric(horizontal: 12, vertical: 8).
final
fieldWidth double?
The width of the field, defaults to 48.
final
gap double?
The gap between the label and the field in the picker. Defaults to 4.
final
hashCode int
The hash code for this object.
no setterinherited
hourLabel Widget?
The widget to display as the label for the hour field.
final
hourPlaceholder Widget?
The widget to display as the placeholder for the hour field, defaults to Text('00').
final
initialDayPeriod ShadDayPeriod?
The initial day period to show in the picker, defaults to ShadDayPeriod.am.
final
initialValue ShadTimeOfDay?
The initial time to show in the picker, defaults to null.
final
jumpToNextFieldWhenFilled bool?
Whether the focus should jump to the next field when the current field is filled. Defaults to true.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardToolbarBuilder WidgetBuilder?
A builder function that returns the toolbar widget.
final
labelStyle TextStyle?
The style of the label. Defaults to theme.textTheme.small.copyWith(fontSize: 12)
final
leading Widget?
The widget to display before the fields in the picker.
final
maxHour int
The maximum hour value that can be selected. Defaults to 23 if variant is ShadTimePickerVariant.primary or 12 if variant is ShadTimePickerVariant.period.
final
maxMinute int
The maximum minute value that can be selected. Defaults to 59.
final
maxSecond int
The maximum second value that can be selected. Defaults to 59.
final
minHour int
The minimum hour value that can be selected. Defaults to 0.
final
minMinute int
The minimum minute value that can be selected. Defaults to 0.
final
minSecond int
The minimum second value that can be selected. Defaults to 0.
final
minuteLabel Widget?
The widget to display as the label for the minute field.
final
minutePlaceholder Widget?
The widget to display as the placeholder for the minute field, defaults to Text('00').
final
onChanged ValueChanged<ShadTimeOfDay>?
The callback that is called when the selected time changes.
final
periodDecoration ShadDecoration?
The decoration of the field, defaults to null.
final
periodHeight double?
The height of the period field, defaults to 42.
final
periodLabel Widget?
The widget to display as the label for the period field.
final
periodMinWidth double?
The min width of the period field, defaults to 65.
final
periodPlaceholder Widget?
The widget to display as the placeholder for the period field, defaults to null.
final
placeholderStyle TextStyle?
The style of the placeholder. Defaults to
final
runAlignment WrapAlignment?
The alignment of the fields in the picker. Defaults to WrapAlignment.center.
final
runSpacing double?
The run spacing between the fields in the picker. Defaults to 4.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondLabel Widget?
The widget to display as the label for the second field.
final
secondPlaceholder Widget?
The widget to display as the placeholder for the second field, defaults to Text('00').
final
showHours bool?
Whether to show the hours field, defaults to true.
final
showMinutes bool?
Whether to show the minutes field, defaults to true.
final
showSeconds bool?
Whether to show the seconds field, defaults to true.
final
spacing double?
The spacing between the fields in the picker. Defaults to 8.
final
style TextStyle?
The style of the label. Defaults to
final
trailing Widget?
The widget to display after the fields in the picker.
final
variant ShadTimePickerVariant
The variant of the time picker.
final

Methods

animate({Key? key, List<Effect>? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) Animate

Available on Widget, provided by the AnimateWidgetExtensions extension

Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex. myWidget.animate() is equivalent to Animate(child: myWidget).
createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ShadTimePicker>
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
positionedWith(ShadPosition position) Widget

Available on Widget, provided by the PositionedExt extension

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