TouchRipple<T> class
Customizable touch ripple for flutter widget
- This package has been developed to resemble Android touch ripple effects. Additionally, it allows for easy definition and customization of animations, features, or actions.
The following describes how to make the declaration.
Example:
TouchRipple(
onTap: () => print('Hello World!'),
child: ... // <- this your widget!
),
How to make sure your event callback function is called after the touch ripple effect is complete:
TouchRipple(
behavior: TouchRippleBehavior(
// Define that the event callback function can be called when
// the touch ripple spreading degree is 100%.
eventCallBackableMinPercent: 1,
),
child: Container(),
);
See also:
- A widget declared to handle click-related events and display them visually to the user.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GestureDectectorCreatable<
T> - TouchRipple
Constructors
-
TouchRipple({Key? key, required Widget child, TouchRippleEventCallBack? onTap, TouchRippleEventAsyncCallBack<
T> ? onTapAsync, TouchRippleEventCallBack? onTapAsyncStart, TouchRippleEventResponseCallback<T> ? onTapAsyncEnd, TouchRippleEventCallBack? onDoubleTap, TouchRippleStateCallBack? onDoubleTapStart, TouchRippleStateCallBack? onDoubleTapEnd, TouchRippleContinuableCheckedCallBack? onLongTap, TouchRippleStateCallBack? onLongTapStart, TouchRippleStateCallBack? onLongTapEnd, TouchRippleBehavior? behavior, TouchRippleBehavior? tapBehavior, TouchRippleBehavior? doubleTapBehavior, TouchRippleBehavior? longTapBehavior, TouchRippleStateCallBack? onHoverStart, TouchRippleStateCallBack? onHoverEnd, TouchRippleStateCallBack? onFocusStart, TouchRippleStateCallBack? onFocusEnd, Color? hoverColor, Duration hoverFadeInDuration = const Duration(milliseconds: 75), Curve hoverFadeInCurve = Curves.easeOut, Duration? hoverFadeOutDuration, Curve? hoverFadeOutCurve, bool isDoubleTapContinuable = true, bool isLongTapContinuable = true, TouchRippleRejectBehavior rejectBehavior = TouchRippleRejectBehavior.leave, TouchRippleCancelledBehavior cancelledBehavior = TouchRippleCancelledBehavior.none, TouchRippleLongTapFocusStartEvent longTapFocusStartEvent = TouchRippleLongTapFocusStartEvent.onRejectable, Color? rippleColor, TouchRippleRenderOrderType renderOrder = TouchRippleRenderOrderType.foreground, double rippleScale = 1, Duration? tapableDuration, HitTestBehavior hitTestBehavior = HitTestBehavior.opaque, Duration? doubleTappableDuration = const Duration(milliseconds: 250), Duration? doubleTapHoldDuration = const Duration(milliseconds: 750), Duration? longTappableDuration, Duration longTapStartDeleyDuration = const Duration(milliseconds: 150), Duration? tapPreviewMinDuration = const Duration(milliseconds: 150), TouchRippleController? controller, BorderRadius borderRadius = BorderRadius.zero, TouchRippleContinuableCheckedCallBack? onDoubleTapContinuableChecked, SystemMouseCursor hoverCursor = SystemMouseCursors.click, double hoverColorRelativeOpacity = 0.4, double focusColorRelativeOpacity = 0.4, bool useHoverEffect = true, bool useFocusEffect = true, Color? focusColor, Duration focusFadeInDuration = const Duration(milliseconds: 150), Curve focusFadeInCurve = Curves.easeOut, Duration? focusFadeOutDuration, Curve? focusFadeOutCurve, bool useDoubleTapFocusEffect = true, bool useLongTapFocusEffect = true, bool isOnHoveredDisableFocusEffect = false, double rippleBlurRadius = 20}) -
const
Properties
- behavior → TouchRippleBehavior?
-
Defines the default behavior of touch ripple all event.
finalinherited
- borderRadius → BorderRadius
-
Same as BorderRadius of ClipRRect.
finalinherited
- cancelledBehavior → TouchRippleCancelledBehavior
-
Defines the behavior that causes the gesture to be cancelled.
finalinherited
- child → Widget
-
The child widget contained by the TouchRipple widget.
finalinherited
- controller → TouchRippleController?
-
This is the controller you define when you need to manage touch ripple effects externally.
finalinherited
- defaultBehavior → TouchRippleBehavior
-
Return the default values for all the defined properties of a touch ripple.
no setteroverride
- defaultDoubleTapBehavior → TouchRippleBehavior
-
Returns the final defined touch ripple behavior of double tap event.
no setterinherited
- defaultHorizontalDragBehavior → TouchRippleBehavior
-
Returns the final defined touch ripple behavior of horizontal drag event.
no setterinherited
- defaultLongTapBehavior → TouchRippleBehavior
-
Returns the final defined touch ripple behavior of long tap event.
no setterinherited
- defaultRippleColor → Color
-
Defines default touch ripple background color of all events.
no setteroverride
- defaultTapBehavior → TouchRippleBehavior
-
Returns the final defined touch ripple behavior of tap event.
no setterinherited
- defaultVerticalDragBehavior → TouchRippleBehavior
-
Returns the final defined touch ripple behavior of horizontal drag event.
no setterinherited
- doubleTapBehavior → TouchRippleBehavior?
-
Defines the behavior applied when a double tap event occurs.
finalinherited
- doubleTapHoldDuration → Duration?
-
Defines the minimum duration to end the double tap state.
finalinherited
- doubleTappableDuration → Duration?
-
The duration between two taps that is considered a double tap,
This refers to the time interval used to recognize double taps.
finalinherited
- focusColor → Color?
-
Defines the background colour of the focus effect that occurs on focus.
finalinherited
- focusColorRelativeOpacity → double
-
Defines what percentage of ripple color opacity the default focus color
will be defined as when no focus color is artificially defined.
finalinherited
- focusFadeInCurve → Curve
-
Defines fade-in curve of focus curved animatin.
finalinherited
- focusFadeInDuration → Duration
-
Defines fade-in duration of focus animatin.
finalinherited
- focusFadeOutCurve → Curve?
-
Defines fade-out curve of focus curved animatin.
finalinherited
- focusFadeOutDuration → Duration?
-
Defines fade-out duration of focus animatin.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hitTestBehavior → HitTestBehavior
-
Same as HitTestBehavior of RawGestureDetector.
finalinherited
- hoverColor → Color?
-
Defines the background color of the hover effect shown when the mouse hovers.
finalinherited
- hoverColorRelativeOpacity → double
-
Defines what percentage of ripple color opacity the default hover color
will be defined as when no hover color is artificially defined.
finalinherited
- hoverCursor → SystemMouseCursor
-
Defines the mouse cursor that is visible when hovering with the mouse.
finalinherited
- hoverFadeInCurve → Curve
-
Defines fade-in curve of hover curved animatin.
finalinherited
- hoverFadeInDuration → Duration
-
Defines fade-in duration of hover animatin.
finalinherited
- hoverFadeOutCurve → Curve?
-
Defines fade-out curve of hover curved animatin.
finalinherited
- hoverFadeOutDuration → Duration?
-
Defines fade-out duration of hover animatin.
finalinherited
- isDoubleTapContinuable → bool
-
Defines whether double tapping is allowed in succession.
finalinherited
- isLongTapContinuable → bool
-
Defines whether long tapping is allowed in succession.
finalinherited
- isOnHoveredDisableFocusEffect → bool
-
Defines whether to disable the focus effect when in a hover state.
finalinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- longTapBehavior → TouchRippleBehavior?
-
Defines the behavior applied when a long tap event occurs.
finalinherited
- longTapFocusStartEvent → TouchRippleLongTapFocusStartEvent
-
finalinherited
- longTappableDuration → Duration?
-
Defines the minimum duration define as a long tap.
finalinherited
- longTapStartDeleyDuration → Duration
-
Defines the amount of duration that must elapse before a long press
gesture is considered initiated.
finalinherited
- onDoubleTap → TouchRippleEventCallBack?
-
Defines a function that is called when the user double taps on that widget.
finalinherited
- onDoubleTapContinuableChecked → TouchRippleContinuableCheckedCallBack?
-
finalinherited
- onDoubleTapEnd → TouchRippleStateCallBack?
-
Defines a function that is called when a double tap event
is fired and the double tap state has ended.
finalinherited
- onDoubleTapStart → TouchRippleStateCallBack?
-
Defines a function that is called when a double tap event
occurs and enters the double tap state.
finalinherited
- onFocusEnd → TouchRippleStateCallBack?
-
Defines a callback function that is called when the focus state ends.
finalinherited
- onFocusStart → TouchRippleStateCallBack?
-
Defines a callback function that is called when the transitions to the focus state.
finalinherited
- onHoverEnd → TouchRippleStateCallBack?
-
Defines a function that is called when the hover state ends.
finalinherited
- onHoverStart → TouchRippleStateCallBack?
-
Defines a function that is called when a hover event
occurs and enters the hover state.
finalinherited
- onLongTap → TouchRippleContinuableCheckedCallBack?
-
Defines a function that is called when the user long tap on that widget.
finalinherited
- onLongTapEnd → TouchRippleStateCallBack?
-
Defines a function that is called when a long tap event
is fired and the long tap state has ended.
finalinherited
- onLongTapStart → TouchRippleStateCallBack?
-
Defines a function that is called when a long tap event
occurs and enters the long tap state.
finalinherited
- onTap → TouchRippleEventCallBack?
-
Defines a function that is called when the user taps on that widget.
finalinherited
-
onTapAsync
→ TouchRippleEventAsyncCallBack<
T> ? -
Defines a async function that is called when the user taps on that widget,
Unlike onTap,
ripples do not disappear and wait before receiving a response.
finalinherited
-
onTapAsyncEnd
→ TouchRippleEventResponseCallback<
T> ? -
Defines a function that is called when async processing for onTapAsync ended.
finalinherited
- onTapAsyncStart → TouchRippleEventCallBack?
-
Defines a function that is called when the start of async processing for onTapAsync.
finalinherited
- rejectBehavior → TouchRippleRejectBehavior
-
Defines the touch ripple reject with pointer position behavior.
finalinherited
- renderOrder → TouchRippleRenderOrderType
-
Defines the order in which the touch ripple effect is drawn.
finalinherited
- rippleBlurRadius → double
-
Defines the radius value of the blur effect of a ripple.
finalinherited
- rippleColor → Color?
-
Defines touch ripple background color of all events.
finalinherited
- rippleScale → double
-
Defines scale of touch ripple effect size.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tapableDuration → Duration?
-
tapableDuration defines the duration after which the tap event is
canceled after the pointerDown event occurs,
finalinherited
- tapBehavior → TouchRippleBehavior?
-
Defines the behavior applied when a tap event occurs.
finalinherited
- tapPreviewMinDuration → Duration?
-
The minimum duration to wait before showing the preview tap effect,
if no other events need to be considered.
finalinherited
- useDoubleTapFocusEffect → bool
-
Defines whether to use the focus effect on double tap state.
finalinherited
- useFocusEffect → bool
-
Defines whether a focus effect should be used throughout.
finalinherited
- useHoverEffect → bool
-
Defines whether a hover effect should be used throughout.
finalinherited
- useLongTapFocusEffect → bool
-
Defines whether to use the focus effect on long tap state.
finalinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createGestureDetector(
{required Widget child, TouchRippleRecognizerCallback? onTap, TouchRippleRejectableCallback? onRejectableTap, TouchRippleRecognizerCountableCallback? onDoubleTap, TouchRippleStateCallBack? onDoubleTapStart, TouchRippleStateCallBack? onDoubleTapEnd, TouchRippleRejectableCallback? onRejectableLongTap, TouchRippleRecognizerCountableCallback? onLongTap, TouchRippleStateCallBack? onLongTapStart, TouchRippleStateCallBack? onLongTapEnd, TouchRippleRecognizerCallback? onCancel, TouchRippleAcceptedCallback? onAccepted, TouchRippleRejectedCallback? onRejected, TouchRippleFocusStartStateCallBack? onFocusStart, TouchRippleStateCallBack? onFocusEnd, Duration? longTappableDuration}) → TouchRippleGestureDetectorWidget -
Create a new instance of the
T
widget that extends fromTouchRippleGestureDetactorWidget
.override -
createState(
) → State< TouchRipple> -
Creates the mutable state for this widget at a given location in the tree.
override
-
createTouchRippleController(
) → TouchRippleController -
Create a new instance of the TouchRippleController,
inherited
-
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