From 7bd6042bbf631dc58672b045b0f7ef2e88dd161d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Elias=20M=C3=BCller?= <elias@elias-mueller.com>
Date: Mon, 12 Feb 2024 13:57:30 +0100
Subject: [PATCH] Fixed wrong text bubble width with small messages

---
 .../pages/talk/components/chatBubble.dart     | 67 ++++++++++---------
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/lib/view/pages/talk/components/chatBubble.dart b/lib/view/pages/talk/components/chatBubble.dart
index 50ca653..f6e01dd 100644
--- a/lib/view/pages/talk/components/chatBubble.dart
+++ b/lib/view/pages/talk/components/chatBubble.dart
@@ -124,47 +124,48 @@ class _ChatBubbleState extends State<ChatBubble> {
                 maxWidth: MediaQuery.of(context).size.width * 0.9,
                 minWidth: showActorDisplayName ? _textSize(widget.bubbleData.actorDisplayName, actorTextStyle).width : 30,
               ),
-              child: Column(
-                mainAxisSize: MainAxisSize.min,
+              child: Stack(
                 children: [
-                  Stack(
-                    children: [
-                      Padding(
-                          padding: EdgeInsets.only(bottom: showBubbleTime ? 18 : 0, top: showActorDisplayName ? 18 : 0),
-                          child: message.getWidget()
+                  Padding(
+                      padding: EdgeInsets.only(bottom: showBubbleTime ? 18 : 0, top: showActorDisplayName ? 18 : 0),
+                      child: message.getWidget()
+                  ),
+                  Visibility(
+                    visible: showActorDisplayName,
+                    child: Positioned(
+                      top: 0,
+                      left: 0,
+                      child: Text(
+                        widget.bubbleData.actorDisplayName,
+                        textAlign: TextAlign.start,
+                        overflow: TextOverflow.ellipsis,
+                        style: actorTextStyle,
                       ),
-                      Visibility(
-                        visible: showActorDisplayName,
-                        child: Positioned(
-                          top: 0,
-                          left: 0,
-                          child: Text(
-                            widget.bubbleData.actorDisplayName,
-                            textAlign: TextAlign.start,
-                            style: actorTextStyle,
-                          ),
-                        ),
+                    ),
+                  ),
+                  Visibility(
+                    visible: showBubbleTime,
+                    child: Positioned(
+                      bottom: 0,
+                      right: 0,
+                      child: Text(
+                        Jiffy.parseFromMillisecondsSinceEpoch(widget.bubbleData.timestamp * 1000).format(pattern: "HH:mm"),
+                        textAlign: TextAlign.end,
+                        style: const TextStyle(color: Colors.grey, fontSize: 12),
                       ),
-                      Visibility(
-                        visible: showBubbleTime,
-                        child: Positioned(
-                          bottom: 0,
-                          right: 0,
-                          child: Text(
-                            Jiffy.parseFromMillisecondsSinceEpoch(widget.bubbleData.timestamp * 1000).format(pattern: "HH:mm"),
-                            textAlign: TextAlign.end,
-                            style: const TextStyle(color: Colors.grey, fontSize: 12),
-                          ),
-                        ),
-                      ),
-                    ],
+                    ),
                   ),
                   Visibility(
                     visible: downloadProgress > 0,
-                    child: LinearProgressIndicator(value: downloadProgress/100)
+                    child: Positioned(
+                      bottom: 0,
+                      right: 0,
+                      left: 0,
+                      child: LinearProgressIndicator(value: downloadProgress/100),
+                    ),
                   ),
                 ],
-              )
+              ),
             ),
           ),
           onLongPress: () {