WDatePicker class

WDatePicker - Utility-First Date Picker Component

A fully styled date picker using Wind utility classes with support for single date and date range selection.

Features:

  • Single Date Selection: Pick a single date
  • Date Range Selection: Pick start and end dates with hover preview
  • Min/Max Constraints: Limit selectable date range
  • Styling: Full Wind className support for trigger and calendar
  • Popover Integration: Uses WPopover for overlay positioning

Single Date Example:

WDatePicker(
  value: _selectedDate,
  onChanged: (date) => setState(() => _selectedDate = date),
  className: 'w-full p-3 border rounded-lg',
  placeholder: 'Select a date',
)

Date Range Example:

WDatePicker(
  mode: WDatePickerMode.range,
  range: _dateRange,
  onRangeChanged: (range) => setState(() => _dateRange = range),
  className: 'w-full p-3 border rounded-lg',
  placeholder: 'Select date range',
)
Inheritance

Constructors

WDatePicker({Key? key, WDatePickerMode mode = WDatePickerMode.single, DateTime? value, DateRange? range, ValueChanged<DateTime>? onChanged, ValueChanged<DateRange>? onRangeChanged, DateTime? minDate, DateTime? maxDate, String? className, String placeholder = 'Select date', bool disabled = false, Set<String> states = const {}, DateDisplayFormat? displayFormat})
Creates a new WDatePicker instance.
const

Properties

className String?
Wind utility classes for the trigger container.
final
disabled bool
Whether the date picker is disabled.
final
displayFormat DateDisplayFormat?
Custom display format function.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
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
placeholder String
Placeholder text when no date is selected.
final
range DateRange?
The currently selected date range (range mode).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
states Set<String>
Custom states for dynamic styling.
final
value DateTime?
The currently selected date (single mode).
final

Methods

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