WFormDatePicker class

A Wind-styled date picker that integrates with Flutter's Form validation.

This widget wraps WDatePicker with FormField to provide:

  • Native Form validation support
  • Automatic error state styling (activates error: prefixed classes)
  • Optional label, hint, and error message display

Basic Usage

WFormDatePicker(
  label: 'Birth Date',
  initialValue: DateTime.now(),
  className: 'p-3 border border-gray-300 rounded-lg error:border-red-500',
  validator: (value) => value == null ? 'Please select a date' : null,
  onChanged: (date) => print('Selected: $date'),
)
Inheritance

Constructors

WFormDatePicker({Key? key, FormFieldValidator<DateTime>? validator, FormFieldSetter<DateTime>? onSaved, AutovalidateMode? autovalidateMode, bool enabled = true, DateTime? initialValue, DateRange? initialRange, WDatePickerMode mode = WDatePickerMode.single, ValueChanged<DateTime>? onChanged, ValueChanged<DateRange>? onRangeChanged, DateTime? minDate, DateTime? maxDate, String? className, String? placeholder, Set<String>? states, DateDisplayFormat? displayFormat, String? label, String labelClassName = 'text-sm font-medium text-gray-700 dark:text-gray-300 mb-1', bool showError = true, String errorClassName = 'text-red-500 dark:text-red-400 text-xs mt-1', String? hint, String hintClassName = 'text-gray-500 dark:text-gray-400 text-xs mt-1'})
Creates a Wind-styled form date picker.

Properties

autovalidateMode AutovalidateMode
Used to enable/disable this form field auto validation and update its error text.
finalinherited
builder FormFieldBuilder<DateTime>
Function that returns the widget representing this form field.
finalinherited
className String?
Wind utility classes for the trigger container.
final
displayFormat DateDisplayFormat?
Custom display format function.
final
enabled bool
Whether the form is able to receive user input.
finalinherited
errorBuilder FormFieldErrorBuilder?
Function that returns the widget representing the error to display.
finalinherited
errorClassName String
Tailwind-like utility classes for styling the error message.
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.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
hint String?
Optional hint text displayed below the picker.
final
hintClassName String
Tailwind-like utility classes for styling the hint.
final
initialRange DateRange?
The initially selected date range (range mode).
final
initialValue DateTime?
An optional value to initialize the form field to, or null otherwise.
finalinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
Optional label text displayed above the date picker.
final
labelClassName String
Tailwind-like utility classes for styling the label.
final
maxDate DateTime?
Maximum selectable date.
final
minDate DateTime?
Minimum selectable date.
final
mode WDatePickerMode
Selection mode: single date or date range.
final
onChanged ValueChanged<DateTime>?
Called when a date is selected (single mode).
final
onRangeChanged ValueChanged<DateRange>?
Called when a date range is selected (range mode).
final
onReset VoidCallback?
An optional method to call when the form field is reset via FormFieldState.reset.
finalinherited
onSaved FormFieldSetter<DateTime>?
An optional method to call with the final value when the form is saved via FormState.save.
finalinherited
placeholder String?
Placeholder text when no date is selected.
final
restorationId String?
Restoration ID to save and restore the state of the form field.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showError bool
Whether to show the error message below the picker.
final
states Set<String>?
Custom states for dynamic styling.
final
validator FormFieldValidator<DateTime>?
An optional method that validates an input. Returns an error string to display if the input is invalid, or null otherwise.
finalinherited

Methods

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