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),
    eventedOffset: Offset.zero,
  );
}
Inheritance
Mixed in types

Constructors

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.

Properties

eventedOffset Offset
The pointer offset that is the reference point for where the effect spreads.
final
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

Methods

addFadeStatusListener(AnimationStatusListener listener) → void
addListener(VoidCallback listener) → void
Register a closure to be called when the object notifies its listeners.
override
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.
override
fadeIn() → void
Run the fade-in animation.
override
fadeOut() → void
Run the fade-out animation.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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.
override
removeFadeStatusListener(AnimationStatusListener listener) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
override
resetWith({required TouchRippleBehavior behavior}) → void
Resets the current animation setting values of this instance with a value that corresponds to the given behavior.
override
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.
override
stop() → void
Stop the actived animation of current instance.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

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