Home > Blockchain >  Flutter align timestamp on bubble chat message
Flutter align timestamp on bubble chat message

Time:11-15

My chat bubble looks like this:

enter image description here

I want its timestamp to stick to the right side like the following:

enter image description here

Here is my code:

   return Align(
      alignment: alignment,
      child: Bubble(
        margin: BubbleEdges.only(
          top: 10,
          left: leftMargin,
          right: rightMargin,
        ),
        color: backgroundColor,
        nip: bubbleNip,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            content,
            const SizedBox(height: 5),
            Text(timeFormat01(timestamp)),
          ],
        ),
      ),
    );

How do I do that?

CodePudding user response:

Wrap timestamp text in Row and with mainaxisalignment set to end.

CodePudding user response:

Use crossAxisAlignment: CrossAxisAlignment.end, on Column

 child: Column(
          crossAxisAlignment: CrossAxisAlignment.end,
          children: [
           content,
  • Related