[MessageWidget] Fix widget gesture detector

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2020-12-09 17:09:19 +05:30
parent 09fcbad900
commit a3e2eec345
+10 -13
View File
@@ -317,7 +317,11 @@ class _MessageWidgetState extends State<MessageWidget> {
messageTheme: widget.messageTheme, messageTheme: widget.messageTheme,
), ),
) )
: Material( : GestureDetector(
onTap: () => retryMessage(context),
onLongPress: () =>
onLongPress(context),
child: Material(
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
shape: widget.shape ?? shape: widget.shape ??
RoundedRectangleBorder( RoundedRectangleBorder(
@@ -331,7 +335,8 @@ class _MessageWidgetState extends State<MessageWidget> {
Brightness Brightness
.dark .dark
? Colors.white ? Colors.white
.withAlpha(24) .withAlpha(
24)
: Colors.black : Colors.black
.withAlpha( .withAlpha(
24), 24),
@@ -373,6 +378,7 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
), ),
), ),
),
if (widget.showReactionPickerIndicator) if (widget.showReactionPickerIndicator)
Positioned( Positioned(
right: 0, right: 0,
@@ -706,10 +712,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(
onTap: () => retryMessage(context),
onLongPress: () => onLongPress(context),
child: Material(
color: _getBackgroundColor(), color: _getBackgroundColor(),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
shape: attachmentShape, shape: attachmentShape,
@@ -736,7 +739,6 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
), ),
), ),
),
); );
} }
@@ -862,7 +864,7 @@ class _MessageWidgetState extends State<MessageWidget> {
} }
Widget _buildTextBubble(BuildContext context) { Widget _buildTextBubble(BuildContext context) {
Widget child = Transform( return Transform(
transform: Matrix4.rotationY(widget.reverse ? pi : 0), transform: Matrix4.rotationY(widget.reverse ? pi : 0),
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
@@ -899,11 +901,6 @@ class _MessageWidgetState extends State<MessageWidget> {
], ],
), ),
); );
return GestureDetector(
onTap: () => retryMessage(context),
onLongPress: () => onLongPress(context),
child: child,
);
} }
bool get isOnlyEmoji => bool get isOnlyEmoji =>