SmartDateTimeRangePicker class
A reusable Date & Time range picker widget.
This widget allows users to:
- Select a start and end date using a calendar
- Select start and end times using a custom time selector
- Receive a validated DateTimeRange once the selection is valid
Key Features
- Supports date range limits via maxRangeDays
- Prevents invalid selections such as:
- End time before start time (on same day)
- Start time earlier than the current time
- Fully themeable via SmartDateTimeTheme
- Labels are customizable using rich text (InlineSpan)
The widget is designed to be:
- Modular (calendar & time can be reused independently)
- Fully controlled via parameters
- Safe for future dates, leap years, and month variations
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SmartDateTimeRangePicker
Constructors
-
SmartDateTimeRangePicker({Key? key, required DateTime minDate, required DateTime maxDate, required int maxRangeDays, required ValueChanged<
DateTimeRange< onChanged, List<DateTime> >int> minuteSteps = const [0, 15, 30, 45], List<InlineSpan> ? calendarLabel, List<InlineSpan> ? startTimeLabel, List<InlineSpan> ? endTimeLabel, SmartDateTimeTheme theme = const SmartDateTimeTheme(), Color surfaceColour = Colors.white, bool allowPastMonths = true}) -
const
Properties
- allowPastMonths → bool
-
Whether navigating to months before the current month is allowed
final
-
calendarLabel
→ List<
InlineSpan> ? -
Optional rich-text label shown above the calendar
final
-
endTimeLabel
→ List<
InlineSpan> ? -
Optional rich-text label shown above the end time selector
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
-
Latest selectable date (inclusive)
final
- maxRangeDays → int
-
Maximum allowed number of days in the selected range
final
- minDate → DateTime
-
Earliest selectable date (inclusive)
final
-
minuteSteps
→ List<
int> -
Allowed minute steps for the time selector
Example:
[0, 15, 30, 45]final -
onChanged
→ ValueChanged<
DateTimeRange< DateTime> > -
Callback fired when a valid date-time range is selected
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
startTimeLabel
→ List<
InlineSpan> ? -
Optional rich-text label shown above the start time selector
final
- surfaceColour → Color
-
Background color of the picker surface
final
- theme → SmartDateTimeTheme
-
Visual configuration for calendar & time widgets
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SmartDateTimeRangePicker> -
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