HuxDateInput class
HuxDateInput is a specialized text input component for date input with automatic formatting, validation, and calendar picker integration.
Provides a clean, modern date input that follows Hux UI design principles with support for custom date formats, validation, and easy date selection.
Example:
HuxDateInput(
label: 'Birth Date',
hint: 'MM/DD/YYYY',
format: DateFormat('MM/dd/yyyy'),
onDateChanged: (date) => print('Selected date: $date'),
validator: (date) {
if (date == null) return 'Date is required';
if (date.isAfter(DateTime.now())) return 'Date cannot be in the future';
return null;
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- HuxDateInput
Constructors
-
HuxDateInput({Key? key, TextEditingController? controller, String? label, String? hint, String? helperText, String? errorText, DateTime? initialDate, DateTime? firstDate, DateTime? lastDate, DateFormat? format, String? placeholder, bool enabled = true, bool showCalendarIcon = true, bool allowManualInput = true, ValueChanged<
DateTime?> ? onDateChanged, ValueChanged<DateTime?> ? onDateSubmitted, String? validator(DateTime?)?, AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction, double? width}) -
Creates a HuxDateInput widget.
const
Properties
- allowManualInput → bool
-
Whether to allow manual text input
final
- autovalidateMode → AutovalidateMode
-
When to show validation errors
final
- controller → TextEditingController?
-
Controller for the text field
final
- enabled → bool
-
Whether the text field is enabled for input
final
- errorText → String?
-
Error text displayed below the text field, overrides helperText
final
- firstDate → DateTime?
-
The earliest selectable date
final
- format → DateFormat?
-
Date format for display and parsing
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperText → String?
-
Helper text displayed below the text field
final
- hint → String?
-
Hint text displayed inside the text field when empty
final
- initialDate → DateTime?
-
The initially selected date
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
Label text displayed above the text field
final
- lastDate → DateTime?
-
The latest selectable date
final
-
onDateChanged
→ ValueChanged<
DateTime?> ? -
Called when the date value changes
final
-
onDateSubmitted
→ ValueChanged<
DateTime?> ? -
Called when the user submits the date field
final
- placeholder → String?
-
Placeholder text when no date is selected
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showCalendarIcon → bool
-
Whether to show the calendar icon button
final
- validator → String? Function(DateTime?)?
-
Validator function for form validation
final
- width → double?
-
Width of the text field (optional, defaults to full width)
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< HuxDateInput> -
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