TimePickerModel class

Model class that manages the state and styling for the CustomTimePickerErfan widget.

This class encapsulates all the data and logic needed for the time picker, including selected time values, date context, colors, text styles, and validation.

Constructors

TimePickerModel.new({required TimeOfDay initialTime, required DateTime selectedDate, Color primaryColor = defaultPrimaryColor, Color backgroundColor = defaultBackgroundColor, Color textColor = const Color.fromARGB(255, 30, 85, 139), Color errorColor = defaultErrorColor, Color disabledColor = defaultDisabledColor, String confirmText = 'Confirm', String cancelText = 'Cancel', String chooseTimeText = 'Choose Time', String hourLabel = 'hour', String minuteLabel = 'min'})
Creates a new TimePickerModel with the specified parameters.

Properties

backgroundColor Color
The background color of the time picker dialog.
final
cancelButtonStyle TextStyle
Returns the text style for the cancel button.
no setter
cancelText String
The text to display on the cancel button.
final
chooseTimeText String
The text to display as the header/title of the time picker.
final
confirmButtonStyle TextStyle
Returns the text style for the confirm button.
no setter
confirmButtonTheme ButtonStyle
Returns the button style for the confirm button.
no setter
confirmText String
The text to display on the confirm button.
final
disabledColor Color
The color used for disabled elements like buttons.
final
errorColor Color
The color used to indicate errors in input validation.
final
errorMessage String?
Returns any error message related to time validation, or null if the time is valid.
no setter
hashCode int
The hash code for this object.
no setterinherited
headerStyle TextStyle
Returns the text style for the header/title of the time picker.
no setter
hourLabel String
The label text displayed above the hour selection wheel.
final
initialTime TimeOfDay
The initial time value that the time picker will display when first shown. This is used to set the starting position of the hour and minute wheels.
final
isEditing bool
Indicates whether the time picker is in editing mode (manual text input).
no setter
minuteLabel String
The label text displayed above the minute selection wheel.
final
primaryColor Color
The primary color used for highlights, headers, selected values, and the confirm button.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedDate DateTime
The date context for the time picker, used to determine if future times should be restricted. If this date is today, times later than the current time will be disabled.
getter/setter pair
selectedHour int
Gets the currently selected hour (0-23).
no setter
selectedMinute int
Gets the currently selected minute (0-59).
no setter
textColor Color
The general text color used throughout the time picker.
final
timeDisplayStyle TextStyle
Returns the text style for the time display component.
no setter
wheelLabelStyle TextStyle
Returns the text style for the wheel labels (hour/min).
no setter

Methods

clearError() → void
Clears any error message that may be displayed.
getFormattedTime() String
Returns the selected time formatted as a string in 24-hour format (HH:MM).
getWheelNumberStyle(bool isSelected) TextStyle
Returns the text style for numbers in the time selection wheels.
handleTimeInput(String input, TextEditingController controller) → void
Handles manual time input from a text field.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setEditing(bool editing) → void
Sets the editing mode of the time picker.
toString() String
A string representation of this object.
inherited
updateSelectedDate(DateTime newDate) → void
Updates the selected date context and validates the current time against it.
updateTime(int hour, int minute) → void
Updates the selected time with the provided hour and minute values.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultBackgroundColor → const Color
The default background color of the time picker dialog. Light gray (#F0F0F0).
defaultDisabledColor → const Color
The default color used for disabled elements like buttons. Light gray (#C8C6C6).
defaultErrorColor → const Color
The default color used to indicate errors in input validation. Material Red 700 (#D32F2F).
defaultPrimaryColor → const Color
The default primary color used for highlights, headers, selected values, and the confirm button. Material Blue 700 (#1976D2).
defaultTextColor → const Color
The default general text color used throughout the time picker. Dark blue-gray (#2C3E50).
selectedTimeColor → const Color
The color used for the selected time text. Same as primary color (#1976D2).
timeDisplayBackgroundColor → const Color
The background color for the time display component. Light blue 50 (#E3F2FD).
wheelSelectedTextColor → const Color
The text color for the selected item in time wheels. Same as primary color (#1976D2).
wheelUnselectedTextColor → const Color
The text color for unselected items in time wheels. Medium gray (#BDBDBD).