HorizontalDatePicker class
A horizontal date strip / timeline date picker widget.
Ideal for booking, scheduling, habit tracking, and fitness applications.
HorizontalDatePicker(
initialDate: DateTime.now(),
startDate: DateTime.now().subtract(const Duration(days: 7)),
endDate: DateTime.now().add(const Duration(days: 30)),
onDateSelected: (date) => print('Selected: $date'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- HorizontalDatePicker
- Available extensions
Constructors
-
HorizontalDatePicker({Key? key, required ValueChanged<
DateTime> onDateSelected, DateTime? initialDate, DateTime? startDate, DateTime? endDate, double itemWidth = 62.0, double height = 92.0, Color? selectedColor, Gradient? selectedGradient, String? locale, Set<DateTime> markedDates = const <DateTime>{}, Set<DateTime> disabledDates = const <DateTime>{}, bool showHeader = true}) -
const
Properties
- centered → Widget
-
Available on Widget, provided by the WidgetX extension
Wraps the widget in a Center.no setter -
disabledDates
→ Set<
DateTime> -
Set of dates that cannot be selected.
final
- endDate → DateTime?
-
The end of the date range (defaults to 60 days after today).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
Overall height of the picker strip.
final
- initialDate → DateTime?
-
The initially selected date (defaults to today).
final
- itemWidth → double
-
Width of each date pill item.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- locale → String?
-
Locale string (e.g. 'en', 'ar').
final
-
markedDates
→ Set<
DateTime> -
Set of dates that have an indicator dot.
final
-
onDateSelected
→ ValueChanged<
DateTime> -
Called when a date is tapped.
final
- repaint → Widget
-
Available on Widget, provided by the WidgetX extension
Wraps in RepaintBoundary to isolate repaints.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedColor → Color?
-
Background color for the selected day card.
final
- selectedGradient → Gradient?
-
Optional gradient for the selected day card.
final
- showHeader → bool
-
Whether to show the month / year header above the strip.
final
- startDate → DateTime?
-
The start of the date range (defaults to 14 days before today).
final
Methods
-
animatedSwitcher(
{Duration duration = const Duration(milliseconds: 300), AnimatedSwitcherTransitionBuilder transitionBuilder = _defaultAnimatedSwitcherTransition, AnimatedSwitcherLayoutBuilder layoutBuilder = AnimatedSwitcher.defaultLayoutBuilder}) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps in an AnimatedSwitcher withdurationand default fade. -
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< HorizontalDatePicker> -
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
-
expanded(
{int flex = 1}) → Widget -
Available on Widget, provided by the WidgetX extension
Expands the widget inside a Flex parent. -
fadeIn(
{double opacity = 1, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeIn}) → Widget -
Available on Widget, provided by the WidgetAnimateX extension
Wraps in an AnimatedOpacity. -
flexible(
{int flex = 1, FlexFit fit = FlexFit.loose}) → Widget -
Available on Widget, provided by the WidgetX extension
Applies flexible sizing. -
keyed(
Object key) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps the widget in a KeyedSubtree withkey. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTap(
VoidCallback onTap, {HitTestBehavior behavior = HitTestBehavior.opaque}) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps the widget in GestureDetector withonTap. -
pad(
{double horizontal = 0, double vertical = 0}) → Widget - Applies symmetric padding.
-
padded(
[double padding = AppSpacing.lg]) → Widget -
Available on Widget, provided by the WidgetX extension
Applies uniformpadding. -
scaleOnTap(
{double scale = 0.95, required VoidCallback onTap, Duration duration = const Duration(milliseconds: 150)}) → Widget -
Available on Widget, provided by the WidgetAnimateX extension
Wraps in an AnimatedScale. -
semantics(
{required String label, bool button = false}) → Widget -
Available on Widget, provided by the WidgetX extension
Wraps in a Semantics node withlabel. -
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
-
visible(
{bool condition = true}) → Widget -
Available on Widget, provided by the WidgetX extension
Hides the widget entirely whenconditionis false. -
withPadding(
EdgeInsetsGeometry padding) → Widget -
Available on Widget, provided by the WidgetX extension
Appliespaddingonly.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited