diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 3b61a42f1..428f260a4 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -1602,6 +1602,13 @@ class ChatController extends State Event? nextEvent, Event? prevEvent, }) { + if (![ + MessageTypes.Text, + MessageTypes.Audio, + ].contains(pangeaMessageEvent.event.messageType)) { + return; + } + // Close keyboard, if open if (inputFocus.hasFocus && PlatformInfos.isMobile) { inputFocus.unfocus(); diff --git a/lib/pangea/widgets/chat/message_selection_overlay.dart b/lib/pangea/widgets/chat/message_selection_overlay.dart index 24e7bc811..102cd7f2a 100644 --- a/lib/pangea/widgets/chat/message_selection_overlay.dart +++ b/lib/pangea/widgets/chat/message_selection_overlay.dart @@ -74,13 +74,20 @@ class MessageSelectionOverlayState extends State double scrollOffset = 0; double animationEndOffset = 0; + final midpoint = (headerBottomOffset + footerBottomOffset) / 2; if (hasHeaderOverflow) { - final midpoint = (headerBottomOffset + footerBottomOffset) / 2; animationEndOffset = midpoint - messageSize!.height; scrollOffset = animationEndOffset - currentBottomOffset; } else if (hasFooterOverflow) { scrollOffset = footerHeight - currentBottomOffset; - animationEndOffset = currentBottomOffset + scrollOffset; + animationEndOffset = footerHeight; + + final bottomOffsetDifference = footerHeight - currentBottomOffset; + final newTopOffset = messageOffset!.dy - bottomOffsetDifference; + if (newTopOffset < (headerHeight + AppConfig.toolbarMaxHeight)) { + animationEndOffset = midpoint - messageSize!.height; + scrollOffset = animationEndOffset - currentBottomOffset; + } } _overlayPositionAnimation = Tween(