Fixed wrong text bubble width with small messages

This commit is contained in:
Elias Müller 2024-02-12 13:57:30 +01:00
parent 9411bfa2dd
commit 7bd6042bbf

View File

@ -124,47 +124,48 @@ class _ChatBubbleState extends State<ChatBubble> {
maxWidth: MediaQuery.of(context).size.width * 0.9, maxWidth: MediaQuery.of(context).size.width * 0.9,
minWidth: showActorDisplayName ? _textSize(widget.bubbleData.actorDisplayName, actorTextStyle).width : 30, minWidth: showActorDisplayName ? _textSize(widget.bubbleData.actorDisplayName, actorTextStyle).width : 30,
), ),
child: Column( child: Stack(
mainAxisSize: MainAxisSize.min,
children: [ children: [
Stack( Padding(
children: [ padding: EdgeInsets.only(bottom: showBubbleTime ? 18 : 0, top: showActorDisplayName ? 18 : 0),
Padding( child: message.getWidget()
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( Visibility(
top: 0, visible: showBubbleTime,
left: 0, child: Positioned(
child: Text( bottom: 0,
widget.bubbleData.actorDisplayName, right: 0,
textAlign: TextAlign.start, child: Text(
style: actorTextStyle, 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( Visibility(
visible: downloadProgress > 0, visible: downloadProgress > 0,
child: LinearProgressIndicator(value: downloadProgress/100) child: Positioned(
bottom: 0,
right: 0,
left: 0,
child: LinearProgressIndicator(value: downloadProgress/100),
),
), ),
], ],
) ),
), ),
), ),
onLongPress: () { onLongPress: () {