TouchRippleState class

Initialize, manage, and connect multiple animation objects to implement the touch ripple effect.

How to initialized:

/// Since multiple tickers need to be created and managed,
/// [SingleTickerProviderStateMixin] should not be used.
class WidgetState extends State<Widget> with TickerProviderStateMixin {

  /// Create a new [TouchRippleState] instance.
  final state =TouchRippleState(
    vsync: this,
    behavior: TouchRippleBehavior(), // Initialize all arguments
    callback: onTap,
    onDismissed: (state) => controller.dispatch(state),
Mixed in types


TouchRippleState({required TickerProvider vsync, required TouchRippleBehavior behavior, required VoidCallback callback, required void onDismissed(TouchRippleState state), required Offset eventedOffset, bool isRejectable = false})
Initializes several animation instance needed to implement the touch ripple effect.


eventedOffset Offset
The pointer offset that is the reference point for where the effect spreads.
fadePercent double
Returns animation progress value of fade animation.
no setter
hashCode int
The hash code for this object.
no setterinherited
isInterlinked bool
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spreadPercent double
Returns animation progress value of spread animation.
no setter


addFadeStatusListener(AnimationStatusListener listener) → void
addListener(VoidCallback listener) → void
Register a closure to be called when the object notifies its listeners.
cancel({required TouchRippleCancelledBehavior cancelledBehavior}) → void
Resets the speed of the fade-out animation to the speed corresponding to the defined action and forces the effect to fade out. In some cases, it cancels the effect altogether.
dispose() → void
Disposes of the initialized animation instances.
fadeIn() → void
Run the fade-in animation.
fadeOut() → void
Run the fade-out animation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
onAccepted() → void
If the gesture could be rejected and is eventually accepted, please call the corresponding function.
onRejected() → void
paint({required Canvas canvas, required Size size, required double scale, required double blur, required Color color}) → void
Perform to take a paint task corresponding to the current state, referencing the given arguments.
removeFadeStatusListener(AnimationStatusListener listener) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
resetWith({required TouchRippleBehavior behavior}) → void
Resets the current animation setting values of this instance with a value that corresponds to the given behavior.
resync(TickerProvider vsync) → void
Redefines the vsync of the current animation instance with the given Ticker Provider.
start() → void
Run the animation initialised in the current instance.
stop() → void
Stop the actived animation of current instance.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.

Static Methods

sizeToOffset(Size size) Offset
Converts the size to an offset and returns it.