ColorInputController class
Reactive controller for managing color input state with color operations.
Extends ValueNotifier to provide state management for color input widgets using ColorDerivative values that support multiple color space representations. Enables programmatic color changes while maintaining color space fidelity.
The controller manages ColorDerivative objects which preserve original color space information (HSV, HSL, RGB) for accurate color manipulations and prevents precision loss during color space conversions.
Example:
final controller = ColorInputController(
ColorDerivative.fromColor(Colors.blue),
);
// React to changes
controller.addListener(() {
print('Color changed to: ${controller.value.color}');
});
// Programmatic control
controller.value = ColorDerivative.fromHSV(HSVColor.fromColor(Colors.red));
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
ColorDerivative> - ColorInputController
- Mixed-in types
Constructors
- ColorInputController(ColorDerivative value)
- Creates a ColorInputController with the specified initial color.
Properties
- color → Color
-
Gets the current color as a standard Color object.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hslColor → HSLColor
-
Gets the current color as an HSL color representation.
no setter
- hsvColor → HSVColor
-
Gets the current color as an HSV color representation.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ ColorDerivative
-
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.
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
-
setColor(
Color color) → void - Sets the color to a new Color value.
-
setHSLColor(
HSLColor hslColor) → void - Sets the color to a new HSL color value.
-
setHSVColor(
HSVColor hsvColor) → void - Sets the color to a new HSV color value.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited