From 2ff70e65dbc14353d2590b62a0560d4fee367b6d Mon Sep 17 00:00:00 2001 From: ggurdin Date: Wed, 11 Sep 2024 12:49:51 -0400 Subject: [PATCH 1/2] if, by shifting up a message to make footer space, a header overflow is caused, opt of push the message down instead of up --- .../widgets/chat/message_selection_overlay.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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( From bd25cda63080f0fac639b541a244b0b536e8e4c8 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Wed, 11 Sep 2024 15:26:39 -0400 Subject: [PATCH 2/2] only show toolbar if the message is text or audio --- lib/pages/chat/chat.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 3370910e7..69617b271 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -1591,6 +1591,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();