import 'package:teso/Classes/ChatMessage.dart'; import 'package:flutter/material.dart'; import 'package:time_elapsed/time_elapsed.dart'; buildSender(BuildContext context, ChatMessage document) { return Container( width: MediaQuery.of(context).size.width, margin: EdgeInsets.only( left: MediaQuery.of(context).size.width * 0.3, top: 20, right: 10), decoration: BoxDecoration(), child: ClipRRect( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), topRight: Radius.circular(20.0), bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(0), ), child: Align( alignment: Alignment.centerRight, child: Container( padding: EdgeInsets.all(10), color: Theme.of(context).colorScheme.secondary, child: Wrap( alignment: WrapAlignment.spaceBetween, spacing: 10.0, direction: Axis.horizontal, children: [ Text(document.content!), Container( child: Align( alignment: Alignment.bottomRight, child: Text( TimeElapsed.fromDateTime(document.timestamp!), textAlign: TextAlign.right, style: TextStyle( fontSize: 10, ), ), ), ), ]), ), ), ), ); }