TouchRipple<T extends dynamic> class

Introduction

This widget, inspired by Google Material's ripple effect, visualizes various gestures such as tap(and async), double tap, and long press through ripple effects.

please refer to GitHub when you want to know more about it.

How to apply ripple effect?

TouchRipple(
  // Called when the user taps or clicks.
  onTap: () => print("Hello, World!"),
  child: ... // <- this your widget
),
Inheritance

Constructors

TouchRipple({Key? key, VoidCallback? onTap, TouchRippleAsyncCallback<T>? onTapAsync, TouchRippleAsyncNotifyCallback<T>? onTapAsyncStart, TouchRippleAsyncResultCallback<T>? onTapAsyncEnd, VoidCallback? onDoubleTap, TouchRippleContinuableCallback? onDoubleTapConsecutive, VoidCallback? onDoubleTapStart, VoidCallback? onDoubleTapEnd, TouchRippleContinuableCallback? onLongTap, VoidCallback? onLongTapStart, VoidCallback? onLongTapEnd, VoidCallback? onFocusStart, VoidCallback? onFocusEnd, VoidCallback? onHoverStart, VoidCallback? onHoverEnd, HitTestBehavior? hitBehavior, Color? rippleColor, Color? hoverColor, Color? focusColor, double? rippleScale, double? rippleBlurRadius, BorderRadius? rippleBorderRadius, Duration? previewDuration, Duration? tappableDuration, Duration? doubleTappableDuration, Duration? doubleTapAliveDuration, Duration? longTappableDuration, Duration? longTapCycleDuration, TouchRippleBehavior? tapBehavior, TouchRippleBehavior? doubleTapBehavior, TouchRippleBehavior? longTapBehavior, TouchRippleRejectBehavior? rejectBehavior, TouchRippleCancelBehavior? cancelBehavior, TouchRippleOverlapBehavior? overlapBehavior, TouchRippleRenderOrderType? renderOrderType, TouchRippleFocusTiming? focusTiming, TouchRippleOrigin? origin, TouchRippleShape? shape, TouchRippleAnimation? hoverAnimation, TouchRippleAnimation? focusAnimation, bool? useHoverEffect, bool? useFocusEffect, bool? onlyMainButton, TouchRippleController? controller, required Widget child})
const

Properties

cancelBehavior TouchRippleCancelBehavior?
The behavior that defines the touch ripple spread animation when the touch ripple effect is canceled.
final
child Widget
The widget that is target to apply touch ripple related effects.
final
controller TouchRippleController?
The controller defines and manages states, listeners, a context and other values related to touch ripple, ensuring that each state exists uniquely within the controller.
final
doubleTapAliveDuration Duration?
The duration until double-tap deactivation. During this period, any single tap is still considered a double-tap without requiring continuous double-tapping.
final
doubleTapBehavior TouchRippleBehavior?
The touch ripple behavior applied to the touch ripple effect for double tapped or double clicked.
final
doubleTappableDuration Duration?
The minimum duration used to distinguish between a tap and a double-tap. If the user does not perform a second tap within this duration, it is considered just a single-tap.
final
focusAnimation TouchRippleAnimation?
The instance of the fade animation for the touch ripple effect when the focus effect is triggered.
final
focusColor Color?
The background color of the solid effect when a consecutive (e.g. about double-tap and long-tap) event state occurs.
final
focusTiming TouchRippleFocusTiming?
The enumeration defines when the focus of a touch ripple should start, specifying the priority based on timing conditions.
final
hashCode int
The hash code for this object.
no setterinherited
hitBehavior HitTestBehavior?
The behavior of hit testing for the child widget.
final
hoverAnimation TouchRippleAnimation?
The instance of the fade animation for the touch ripple effect when the hover effect is triggered.
final
hoverColor Color?
The background color of a effect when the user hovers.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
longTapBehavior TouchRippleBehavior?
The touch ripple behavior applied to the touch ripple effect for long tapped or long pressed and long clicked.
final
longTapCycleDuration Duration?
The duration until long-tap reactivation. After this period, any pointer down and move is still considered a long-tap without requiring the continuous process of pointer-up followed by pointer-down.
final
longTappableDuration Duration?
The minimum duration used to distinguish between a tap and a long-tap. After this duration has passed, the long-tap effect starts to be displayed to the user.
final
onDoubleTap VoidCallback?
The callback function is called when the user double taps or double clicks.
final
onDoubleTapConsecutive TouchRippleContinuableCallback?
The callback function is called to determine whether consecutive double taps should continue. It returns a bool indicating whether the long tap event should continue after the initial occurrence.
final
onDoubleTapEnd VoidCallback?
The callback function is a lifecycle callback for the double-tap event. It is called when a double tap ends, providing the advantage of knowing when a series of consecutive double taps has finished.
final
onDoubleTapStart VoidCallback?
The callback function is a lifecycle callback for the double-tap event. It is called when a double tap starts, which is useful for handling actions that occur during successive double taps.
final
onFocusEnd VoidCallback?
The callback function is a lifecycle callback for focus touch ripple events. It is called when a focus touch event ends, providing the advantage of knowing when a series of focus touch ripple events has concluded.
final
onFocusStart VoidCallback?
The callback function is a lifecycle callback for focus touch ripple events. It is called when a focus touch event starts, allowing for the initiation of actions based on the beginning of the focus event sequence.
final
onHoverEnd VoidCallback?
The callback function called when the cursor begins to leave the widget. (by MouseRegion) This function allows for actions to be executed based on the end of the hover interaction. This function is not called in touch-based environments yet.
final
onHoverStart VoidCallback?
The callback function called when the cursor begins hovering over the widget. (by MouseRegion) This function allows for the initiation of actions based on the hover interaction. This function is not called in touch-based environments yet.
final
onLongTap TouchRippleContinuableCallback?
The callback function is called when the user long presses or long clicks.
final
onLongTapEnd VoidCallback?
The callback function is a lifecycle callback for the long-tap event. It is called when a long tap ends, providing the advantage of knowing when a series of consecutive long taps has concluded.
final
onLongTapStart VoidCallback?
The callback function is a lifecycle callback for the long-tap event. It is called when a long tap starts, which is useful for initiating actions that require a sustained press.
final
onlyMainButton bool?
The boolean that is whether only the main button is recognized as a gesture when the user that is using mouse device clicks on the widget.
final
onTap VoidCallback?
The callback function is called when the user taps or clicks.
final
onTapAsync TouchRippleAsyncCallback<T>?
The callback function is called when the user taps or clicks. but this function ensures that the touch ripple effect remains visible until the asynchronous operation is completed and prevents additional events during that time.
final
onTapAsyncEnd TouchRippleAsyncResultCallback<T>?
The callback function is called when the result of the asynchronous operation is ready. It allows handling the result once the operation is complete.
final
onTapAsyncStart TouchRippleAsyncNotifyCallback<T>?
The callback function is called when an asynchronous operation is initiated by a tap. It provides the associated Future instance for the ongoing operation.
final
origin TouchRippleOrigin?
The enumeration defines the starting point of a spread ripple effect, specifying the origin of the ripple based on the user interaction.
final
overlapBehavior TouchRippleOverlapBehavior?
The behavior of a touch ripple when it overlaps with other ripple effects. (e.g. overlappable, cancel, ignore)
final
previewDuration Duration?
The duration for which the ripple effect is previewed even if the gesture is not finalized, allowing the user to see the effect while the pointer is down or moving.
final
rejectBehavior TouchRippleRejectBehavior?
The behavior that defines when a gesture should be rejected, specifying the conditions for rejection.
final
renderOrderType TouchRippleRenderOrderType?
The enumeration specifies the rendering order of the touch ripple effect, determining whether it should appear in the foreground or background.
final
rippleBlurRadius double?
The radius pixels of a blur filter for spread ripple effect. It cannot be negative and as the value increases, the edge of the spread ripple effect becomes blurrier.
final
rippleBorderRadius BorderRadius?
The instance of a border radius for a ripple effect. For reference, this option can be replaced with a widget like ClipRRect depending on the situation.
final
rippleColor Color?
The background color of a spread ripple effect.
final
rippleScale double?
The scale percentage value of a ripple effect and by default the origin position is center.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape TouchRippleShape?
The enumeration defines the shape of the ripple effect based on the widget layout, specifying how the ripple appears visually.
final
tapBehavior TouchRippleBehavior?
The touch ripple behavior applied to the touch ripple effect for tapped or clicked.
final
tappableDuration Duration?
The duration after which the gesture is considered rejected if the pointer is still down and no tap is completed. If this duration elapses without a successful gesture, the gesture will be rejected.
final
useFocusEffect bool?
Whether the focus effect is enabled for touch ripple animations. If true, a solid focus color effect is applied for consecutive events like double-tap and long-tap or others.
final
useHoverEffect bool?
Whether the hover effect is enabled for touch ripple animations. If true, a solid hover effect is applied when the user hovers.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<TouchRipple>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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