SwipeableBubble class

A wrapper widget that adds swipe gesture support to any chat bubble.

Wrap any bubble widget with SwipeableBubble to enable swipe-to-reply (swipe right) and swipe-to-delete (swipe left) gestures.

child is the bubble widget to wrap.

onSwipeRight is called when the user swipes right past swipeThreshold. Typically used for reply actions.

onSwipeLeft is called when the user swipes left past swipeThreshold. Typically used for delete actions.

swipeThreshold is the horizontal distance (in logical pixels) the user must drag before the action is triggered. Defaults to 64.0.

enableHaptics enables haptic feedback when the threshold is crossed. Defaults to true.

rightActionColor is the background color revealed on swipe-right. Defaults to Colors.blue.

leftActionColor is the background color revealed on swipe-left. Defaults to Colors.red.

rightActionIcon is the icon revealed on swipe-right. Defaults to Icons.reply.

leftActionIcon is the icon revealed on swipe-left. Defaults to Icons.delete.

Inheritance

Constructors

SwipeableBubble({Key? key, required Widget child, VoidCallback? onSwipeRight, VoidCallback? onSwipeLeft, double swipeThreshold = 64.0, bool enableHaptics = true, Color rightActionColor = Colors.blue, Color leftActionColor = Colors.red, Icon rightActionIcon = const Icon(Icons.reply, color: Colors.white), Icon leftActionIcon = const Icon(Icons.delete, color: Colors.white)})
Creates a SwipeableBubble widget
const

Properties

child Widget
The bubble widget to wrap
final
enableHaptics bool
Whether to emit haptic feedback when the threshold is crossed
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leftActionColor Color
Background color revealed on swipe-left
final
leftActionIcon Icon
Icon revealed on swipe-left
final
onSwipeLeft VoidCallback?
Called when the user swipes left past swipeThreshold
final
onSwipeRight VoidCallback?
Called when the user swipes right past swipeThreshold
final
rightActionColor Color
Background color revealed on swipe-right
final
rightActionIcon Icon
Icon revealed on swipe-right
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
swipeThreshold double
Minimum drag distance to trigger the action. Defaults to 64.0
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SwipeableBubble>
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, int wrapWidth = 65}) 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