Issue
In my App I create a chat. This is my messageTile. Does anyone know how I can add a another text to this Container? Because this text should be the time when the user sends the message.
class MessageTile extends StatelessWidget {
final String message;
final bool sendByMe;
final int time;
MessageTile({@required this.message, @required this.sendByMe, @required this.time});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(
top: 3,
bottom: 3,
left: sendByMe ? 0 : 24,
right: sendByMe ? 24 : 0),
alignment: sendByMe ? Alignment.centerRight : Alignment.centerLeft,
child: Container(
margin: sendByMe
? EdgeInsets.only(left: 30)
: EdgeInsets.only(right: 30),
padding: EdgeInsets.only(
top: 17, bottom: 17, left: 20, right: 20),
decoration: BoxDecoration(
borderRadius: sendByMe ? BorderRadius.only(
topLeft: Radius.circular(9),
topRight: Radius.circular(9),
bottomLeft: Radius.circular(9),
) :
BorderRadius.only(
topLeft: Radius.circular(9),
topRight: Radius.circular(9),
bottomRight: Radius.circular(9)),
color: sendByMe ? Colors.blue : Colors.white
),
child: Text(message,
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontFamily: 'Orbitron',
fontSize: 9.0,),),
),
);
}
Solution
Wrap in a column or row depending on your layout. The text should simply be DateTime.now().toString()
.
Answered By - krumpli
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.