SelectionController class
Controls date selection state, supporting single, multiple, and range modes.
Call onDateTap when the user taps a date. The controller automatically manages selection state based on the current SelectionMode and notifies listeners of changes.
- Inheritance
-
- Object
- ChangeNotifier
- SelectionController
Constructors
- SelectionController({SelectionMode mode = SelectionMode.single})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- mode → SelectionMode
-
no setter
- rangeEnd → DateTime?
-
no setter
- rangeStart → DateTime?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedDate → DateTime?
-
no setter
-
selectedDates
→ Set<
DateTime> -
no setter
- selectedRange → DateRange?
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearSelection(
) → void - Clears all selection state and notifies listeners.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
isInRange(
DateTime date) → bool -
Returns
trueifdatefalls within the currently selected range. -
isRangeEnd(
DateTime date) → bool -
Returns
trueifdateis the end of the selected range. -
isRangeStart(
DateTime date) → bool -
Returns
trueifdateis the start of the selected range. -
isSelected(
DateTime date) → bool -
Returns
trueifdateis currently selected (in any mode). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onDateTap(
DateTime date) → void - Handles a date tap, updating the selection based on the current mode.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setMode(
SelectionMode mode) → void - Changes the selection mode and clears any existing selection.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited