fix longpress gesturedetector on message

This commit is contained in:
Salvatore Giordano
2021-01-04 12:08:14 +01:00
parent d0c4656973
commit 041c1930c2
+14 -13
View File
@@ -260,6 +260,8 @@ class _MessageWidgetState extends State<MessageWidget> {
true; true;
return Portal( return Portal(
child: GestureDetector(
onLongPress: () => onLongPress(context),
child: Padding( child: Padding(
padding: widget.padding ?? EdgeInsets.all(8), padding: widget.padding ?? EdgeInsets.all(8),
child: Transform( child: Transform(
@@ -311,7 +313,9 @@ class _MessageWidgetState extends State<MessageWidget> {
Padding( Padding(
padding: widget.showReactions padding: widget.showReactions
? EdgeInsets.only( ? EdgeInsets.only(
top: widget.message.reactionCounts top: widget
.message
.reactionCounts
?.isNotEmpty == ?.isNotEmpty ==
true true
? 18 ? 18
@@ -326,8 +330,8 @@ class _MessageWidgetState extends State<MessageWidget> {
widget.reverse ? pi : 0), widget.reverse ? pi : 0),
child: DeletedMessage( child: DeletedMessage(
reverse: widget.reverse, reverse: widget.reverse,
borderRadiusGeometry: borderRadiusGeometry: widget
widget.borderRadiusGeometry, .borderRadiusGeometry,
borderSide: widget.borderSide, borderSide: widget.borderSide,
shape: widget.shape, shape: widget.shape,
messageTheme: messageTheme:
@@ -369,7 +373,8 @@ class _MessageWidgetState extends State<MessageWidget> {
hasFiles ? 2.0 : 0.0), hasFiles ? 2.0 : 0.0),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
mainAxisSize: mainAxisSize:
MainAxisSize.min, MainAxisSize.min,
children: <Widget>[ children: <Widget>[
@@ -379,7 +384,8 @@ class _MessageWidgetState extends State<MessageWidget> {
.trim() .trim()
.isNotEmpty && .isNotEmpty &&
!isGiphy) !isGiphy)
_buildTextBubble(context), _buildTextBubble(
context),
], ],
), ),
), ),
@@ -432,6 +438,7 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
), ),
), ),
),
); );
} }
@@ -739,9 +746,7 @@ class _MessageWidgetState extends State<MessageWidget> {
}) { }) {
final attachmentShape = final attachmentShape =
widget.attachmentShape ?? widget.shape ?? _getDefaultShape(context); widget.attachmentShape ?? widget.shape ?? _getDefaultShape(context);
return GestureDetector( return Material(
onLongPress: () => onLongPress(context),
child: Material(
color: _getBackgroundColor(), color: _getBackgroundColor(),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
shape: attachmentShape, shape: attachmentShape,
@@ -758,7 +763,6 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
), ),
), ),
),
); );
} }
@@ -854,10 +858,7 @@ class _MessageWidgetState extends State<MessageWidget> {
], ],
), ),
); );
return GestureDetector( return child;
onLongPress: () => onLongPress(context),
child: child,
);
} }
bool get isOnlyEmoji => bool get isOnlyEmoji =>