added minimum message drag distance for chat reply
This commit is contained in:
parent
8868914a76
commit
626d3d5564
@ -282,14 +282,15 @@ class _ChatBubbleState extends State<ChatBubble> with SingleTickerProviderStateM
|
|||||||
if(!widget.bubbleData.isReplyable) return;
|
if(!widget.bubbleData.isReplyable) return;
|
||||||
var dx = details.delta.dx - _dragStartPosition.dx;
|
var dx = details.delta.dx - _dragStartPosition.dx;
|
||||||
setState(() {
|
setState(() {
|
||||||
_position = (_position.dx + dx).abs() > 30 ? Offset(_position.dx, 0) : Offset(_position.dx + dx, 0);
|
_position = (_position.dx + dx).abs() > 60 ? Offset(_position.dx, 0) : Offset(_position.dx + dx, 0);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onHorizontalDragEnd: (DragEndDetails details) {
|
onHorizontalDragEnd: (DragEndDetails details) {
|
||||||
|
var isAction = _position.dx.abs() > 50;
|
||||||
setState(() {
|
setState(() {
|
||||||
_position = const Offset(0, 0);
|
_position = const Offset(0, 0);
|
||||||
});
|
});
|
||||||
if(widget.bubbleData.isReplyable) {
|
if(widget.bubbleData.isReplyable && isAction) {
|
||||||
Provider.of<ChatProps>(context, listen: false).setReferenceMessageId(widget.bubbleData.id, context, widget.chatData.token);
|
Provider.of<ChatProps>(context, listen: false).setReferenceMessageId(widget.bubbleData.id, context, widget.chatData.token);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user