SliderController class
Reactive controller for managing slider state with value operations.
Extends ValueNotifier to provide state management for slider widgets using SliderValue objects that support both single and range slider configurations. Enables programmatic slider value changes and provides convenient methods for common slider operations.
The controller manages SliderValue objects which can represent either single values or dual-thumb range values, providing unified state management for different slider types.
Example:
final controller = SliderController(SliderValue.single(0.5));
// React to changes
controller.addListener(() {
print('Slider value: ${controller.value}');
});
// Programmatic control
controller.setValue(0.75);
controller.setRange(0.2, 0.8);
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
SliderValue> - SliderController
- Mixed-in types
Constructors
- SliderController.new(SliderValue value)
- Creates a SliderController with the specified initial value.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isRanged → bool
-
Returns true if the slider is in range mode.
no setter
- isSingle → bool
-
Returns true if the slider is in single-value mode.
no setter
- rangeEnd → double
-
Gets the current range end value (valid only in range mode).
no setter
- rangeStart → double
-
Gets the current range start value (valid only in range mode).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- singleValue → double
-
Gets the current single value (valid only in single mode).
no setter
- value ↔ SliderValue
-
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setRange(
double start, double end) → void - Sets the slider to a range value configuration.
-
setValue(
double value) → void - Sets the slider to a single value configuration.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited