TouchRipple class
The TouchRipple widget is define your custom touch ripple effect.
See also:
- For enquiries or bugs, please send them to rootlouibooks@gmail.com.
- Refer to the appropriate code to implement page movement with the
Ripple
.
TouchRipple(
// Until the ripple effect end hold the call of the [Ripple.onTap],
// Prevents the ripple effect from being invisible and page shifting.
startOnTap: StartOnTap(isWait: true)
child: ... // <- this your widget!
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TouchRipple
Constructors
- TouchRipple({Key? key, required Widget child, Clip clipBehavior = Clip.hardEdge, BorderRadius borderRadius = BorderRadius.zero, BorderRadius rippleRadius = BorderRadius.zero, SystemMouseCursor? cursor, DoubleTapBehavior doubleTapBehavior = DoubleTapBehavior.cancel, LongPressBehavior longPressBehavior = LongPressBehavior.cancel, RippleOverlapBehavior overlapBehavior = RippleOverlapBehavior.cancel, RippleOverlapBehavior? tapOverlapBehavior, RippleOverlapBehavior? doubleTapOverlapBehavior, StartTapRippleEffect startTapEffect = StartTapRippleEffect.pointerDown, double touchSlop = kTouchSlop, bool isActive = true, StartOnEvent startOnTap = const StartOnEvent(isWait: false), StartOnEvent startOnDoubleTap = const StartOnEvent(isWait: false), double durationScale = 1, Color rippleColor = const Color.fromRGBO(0, 0, 0, 0.4), ColorTween? rippleColorTween, Color? foregroundColor, ColorTween? foregroundColorTween, Color? longPressRippleColor, ColorTween? longPressRippleColorTween, bool useEffect = true, bool? useTapEffect, bool? useDoubleTapEffect, bool? useLongPressEffect, bool useForeground = false, bool? useTapForeground, bool? useDoubleTapForeground, bool? useLongPressForeground, double lowerPercent = 0.4, double upperPercent = 1, double? tapLowerPercent, double? tapUpperPercent, double? doubleTapLowerPercent, double? doubleTapUpperPercent, double? longPressLowerPercent, double? longPressUpperPercent, double scale = 1, double? tapScale, double? doubleTapScale, double? longPressScale, Duration rippleDuration = const Duration(milliseconds: 150), Curve rippleCurve = Curves.easeOut, Duration rippleFadeInDuration = const Duration(milliseconds: 25), Curve rippleFadeInCurve = Curves.easeOut, Duration rippleFadeOutDuration = const Duration(milliseconds: 150), Curve rippleFadeOutCurve = Curves.easeIn, Duration canceledRippleDuration = Duration.zero, Curve canceledRippleCurve = Curves.ease, Duration longPressDuration = const Duration(seconds: 1), Curve longPressCurve = Curves.linear, Duration? longPressFadeInDuration, Curve longPressFadeInCurve = Curves.linear, Duration longPressFadeOutDuration = const Duration(milliseconds: 100), Curve longPressFadeOutCurve = Curves.ease, Duration canceledLongPressDuration = Duration.zero, Curve canceledLongPressCurve = Curves.ease, Duration foregroundFadeInDuration = const Duration(milliseconds: 150), Curve foregroundFadeInCurve = Curves.easeOut, Duration foregroundFadeOutDuration = const Duration(milliseconds: 150), Curve foregroundFadeOutCurve = Curves.easeIn, Duration canceledForegroundDuration = Duration.zero, Curve canceledForegroundCurve = Curves.easeIn, required Function onTap, OnDoubleTap? onDoubleTap, Function? onDoubleTapStart, Function? onDoubleTapEnd, OnLongPress? onLongPress, Function? onHover, Function? onHoverStart, Function? onHoverEnd, Function? onCancel, OnPointer? onPointerDown, OnPointer? onPointerMove, OnPointer? onPointerUp, OnPointer? onPointerCancel, Duration tapableDuration = Duration.zero, Duration doubleTapStateDuration = const Duration(milliseconds: 250), Duration doubleTapStateCancellationDuration = const Duration(milliseconds: 500), Duration startTapEffectDuration = const Duration(milliseconds: 100)})
-
const
Properties
- borderRadius → BorderRadius
-
border radius of the ClipRRect contained by the ripple widget.
final
- canceledForegroundCurve → Curve
-
Animation curve of canceled foreground fade out(reverse),
Curved animation of foregroundFadeOutDuration.
final
- canceledForegroundDuration → Duration
-
Fade-out animation duration of canceled foreground.
final
- canceledLongPressCurve → Curve
-
Animation curve of longpress canceled ripple effect fade out(reverse),
Curved animation of canceledLongPressDuration.
final
- canceledLongPressDuration → Duration
-
Fade-out animation duration of canceled longpress ripple effect.
final
- canceledRippleCurve → Curve
-
Animation curve of canceled ripple effect fade out(reverse),
Curved animation of canceledRippleDuration.
final
- canceledRippleDuration → Duration
-
Fade-out animation duration used when ripple effect
are canceled by touchSlop and RippleOverlapBehavior.cancel.
final
- child → Widget
-
The child contained by the ripple widget,
final
- clipBehavior → Clip
-
clip of the ClipRRect contained by the ripple widget.
final
- cursor → SystemMouseCursor?
-
Mouse cursor when in hover state.
final
- doubleTapBehavior → DoubleTapBehavior
-
behavior when double tabs occur continuously.
final
- doubleTapLowerPercent → double
-
The lowerPercent of double tap ripple effect.
final
- doubleTapOverlapBehavior → RippleOverlapBehavior
-
double tap event type behavior when a ripple effect needs to be
displayed when the ripple effect is not complete.
final
- doubleTapScale → double
-
The scale of double tap effect.
final
- doubleTapStateCancellationDuration → Duration
-
Minimum duration to enter the double tap state and cancel the state.
final
- doubleTapStateDuration → Duration
-
Minimum duration to define whether it is a tap or double tap.
final
- doubleTapUpperPercent → double
-
The upperPercent of double tap ripple effect.
final
- durationScale → double
-
Duration speed scale.
final
- foregroundColor → Color?
-
background color behind ripple effect.
final
- foregroundColorTween → ColorTween?
-
background color tween behind ripple effect.
final
- foregroundFadeInCurve → Curve
-
Animation curve of foreground fade in(forward),
Curved animation of foregroundFadeInDuration.
final
- foregroundFadeInDuration → Duration
-
Fade-in animation duration of foreground.
final
- foregroundFadeOutCurve → Curve
-
Animation curve of foreground fade out(reverse),
Curved animation of foregroundFadeOutDuration.
final
- foregroundFadeOutDuration → Duration
-
Fade-out animation duration of foreground.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
Whether to use the ripple widget and all events.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- longPressBehavior → LongPressBehavior
-
whether longpress can occur continuously.
final
- longPressCurve → Curve
-
Animation curve of longpress ripple effect(forward),
Curved animation of longPressDuration.
final
- longPressDuration → Duration
-
Minimum duration to define whether it is tap or longpress
final
- longPressFadeInCurve → Curve
-
Animation curve of longpress ripple effect fade in(forward),
Curved animation of longPressFadeInDuration.
final
- longPressFadeInDuration → Duration
-
Fade-in animation duration of longpress ripple effect.
final
- longPressFadeOutCurve → Curve
-
Animation curve of longpress ripple effect fade out(reverse),
Curved animation of longPressFadeOutDuration.
final
- longPressFadeOutDuration → Duration
-
Fade-out animation duration of longpress ripple effect.
final
- longPressLowerPercent → double
-
The lowerPercent of longpress ripple effect.
final
- longPressRippleColor → Color?
-
Ripple effect color in longpress state
final
- longPressRippleColorTween → ColorTween?
-
Ripple effect color tween in longpress state
final
- longPressScale → double
-
The scale of longpress effect.
final
- longPressUpperPercent → double
-
The upperPercent of longpress ripple effect.
final
- lowerPercent → double
-
Integrally define the lower percent of different event types,
Define the minimum spread of the ripple effect as a percent.
final
- onCancel → Function?
-
final
- onDoubleTap → OnDoubleTap?
-
When double (click or touch).
final
- onDoubleTapEnd → Function?
-
If the double tap state is canceled.
final
- onDoubleTapStart → Function?
-
If the double tap has started.
final
- onHover → Function?
-
Same as
Listener.onHover
final - onHoverEnd → Function?
-
Same as MouseRegion.onExit
final
- onHoverStart → Function?
-
Same as MouseRegion.onEnter
final
- onLongPress → OnLongPress?
-
If the user continues to press for a certain period of time without lifting their hand.
final
- onPointerCancel → OnPointer?
-
Same as Listener.onPointerCancel
final
- onPointerDown → OnPointer?
-
Same as Listener.onPointerDown
final
- onPointerMove → OnPointer?
-
Same as Listener.onPointerMove
final
- onPointerUp → OnPointer?
-
Same as Listener.onPointerUp
final
- onTap → Function
-
When one (click or touch).
final
- overlapBehavior → RippleOverlapBehavior
-
all event type behavior when a ripple effect needs to be displayed
when the ripple effect is not complete.
final
- rippleColor → Color
-
Ripple effect background color
final
- rippleColorTween → ColorTween?
-
Ripple effect background color tween
final
- rippleCurve → Curve
-
Animation curve of ripple effect,
Curved animation of rippleDuration.
final
- rippleDuration → Duration
-
Spread duration of ripple effect.
final
- rippleFadeInCurve → Curve
-
Animation curve of ripple effect fade in(forward),
Curved animation of rippleFadeInDuration.
final
- rippleFadeInDuration → Duration
-
Fade in animation of ripple effect.
final
- rippleFadeOutCurve → Curve
-
Animation curve of ripple effect fade out(reverse),
Curved animation of rippleFadeOutDuration.
final
- rippleFadeOutDuration → Duration
-
Fade out animation of ripple effect.
final
- rippleRadius → BorderRadius
-
The border radius is referenced only by RipplePainter (ripple effect).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale → double
-
The scale of ripple effect size.
final
- startOnDoubleTap → StartOnEvent
-
Define when onDoubleTap is called.
final
- startOnTap → StartOnEvent
-
Define when onTap is called.
final
- startTapEffect → StartTapRippleEffect
-
The behavior on what events occur and forward ripple effect.
final
- startTapEffectDuration → Duration
-
Pointer down occurs and ripple effects occur only after a certain period of duration.
final
- tapableDuration → Duration
-
Minimum tapable duration based on pointer down.
final
- tapLowerPercent → double
-
The lowerPercent of tap ripple effect.
final
- tapOverlapBehavior → RippleOverlapBehavior
-
tap event type behavior when a ripple effect needs to be
displayed when the ripple effect is not complete.
final
- tapScale → double
-
The scale of tap effect.
final
- tapUpperPercent → double
-
The upperPercent of tap ripple effect.
final
- touchSlop → double
-
the distance at which the minimum pixel
must be moved to accurately define the gesture.
final
- upperPercent → double
-
Integrally define the upper percent of different event types,
Define the maximum spread of the ripple effect as a percent.
final
- useDoubleTapEffect → bool
-
Whether to use ripple effect when double tap
final
- useDoubleTapForeground → bool
-
Whether to use foreground when double tap
final
- useEffect → bool
-
Integrally define whether to use ripple-related effects.
final
- useForeground → bool
-
Integrally define whether to use foreground.
final
- useLongPressEffect → bool
-
Whether to use ripple effect when longpress
final
- useLongPressForeground → bool
-
Whether to use foreground when longpress
final
- useTapEffect → bool
-
Whether to use ripple effect when tap
final
- useTapForeground → bool
-
Whether to use foreground when tap
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