CalendarState class
The (immutable) state of selections on the calendar.
Constructors
-
CalendarState({List<
CalendarSelection> ? selections, String? currentSelection, CausedBy? cause, Date? preview, bool previewAnchoredAtStart = false, dynamic resolution = CalendarResolution.days}) - CalendarState.empty({String currentSelection = 'default', dynamic resolution = CalendarResolution.days})
-
CalendarState.selected(List<
CalendarSelection> selections, {dynamic resolution = CalendarResolution.days, dynamic cause = CausedBy.external}) - Creates a calendar state initialized with the given selections. The first element in the list is set as the current selection.
Properties
- cause → CausedBy?
-
Describes the user action that produced this state
final
- currentSelection → String?
-
The ID of the selection to update when the calendar is interacted with.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- preview → Date?
-
If non-null, the user is currently previewing a modification to the
current selection, and this is the date the user is interacting with to
produce this preview.
final
- previewAnchoredAtStart → bool
-
A preview highlights a range with two endpoints - one is
preview, and the other is either the start (ifpreviewAnchoredAtStartis true) or the end (ifpreviewAnchoredAtStartis false) of thecurrentSelection. This variable is still relevant even ifpreviewis null, because it specifies which endpoint will become the anchor if previewing begins.final - resolution → CalendarResolution
-
The smallest relevant unit of time in the context of the calendar.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selections
→ List<
CalendarSelection> -
The current set of selections.
final
Methods
-
cancelCurrentPreview(
) → CalendarState -
Ends preview mode, if applicable.
This only changes the preview state. The
causeis stillpreview. -
clearCurrentSelection(
) → CalendarState - Delete the "current" selection. Note this is different from creating a selection with null endpoints, which for the date-range-picker means "All Time". After this call, no dates will be selected.
-
clearSelection(
String? id) → CalendarState - Removes the identified selection from the list of selections. If the identified selection does not exist, has no effect.
-
confirmPreview(
{bool confirmRange = false, required bool movingStartMaintainsLength}) → CalendarState -
Updates one endpoint of the "current" selection to match the preview
confirmRange- If true, this the last endpoint to be set for the current range. This information is not used by CalendarState directly, but clients of CalendarState may need it. -
has(
String? id) → bool -
highlighted(
String? id, Date date) → bool - Return true if the given date is highlighted by the given selection, or by a preview of the given selection.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
select(
String? id, {bool previewAnchoredAtStart = false}) → CalendarState - Sets the range with the given ID as the "current selection" -- the range that'll get updated when the user clicks on the calendar.
-
selection(
String? id) → CalendarSelection -
setCurrentSelection(
Date a, Date? b, {CausedBy cause = CausedBy.rangeConfirm, bool previewAnchoredAtStart = false}) → CalendarState - Sets both endpoints of the "current" selection
-
setSelection(
CalendarSelection val, {CausedBy cause = CausedBy.external, bool previewAnchoredAtStart = false}) → CalendarState - Updates the value for the given selection. Creates it if it's not in the list of selections already.
-
toString(
) → String -
A string representation of this object.
override
-
updateCurrentPreview(
Date newPreviewTarget) → CalendarState -
Updates the preview endpoint and sets
causetopreviewing. -
updateDrag(
Date a, Date? b) → CalendarState - Updates the "current" selection's endpoints, with "dragging" as the cause (the user is still dragging the current selection).
Operators
-
operator ==(
Object o) → bool -
The equality operator.
override