import 'package:Envelope/components/custom_circle_avatar.dart';
|
|
import 'package:Envelope/models/conversations.dart';
|
|
import 'package:flutter/material.dart';
|
|
import '/views/main/conversation_detail.dart';
|
|
|
|
class ConversationListItem extends StatefulWidget{
|
|
final Conversation conversation;
|
|
const ConversationListItem({
|
|
Key? key,
|
|
required this.conversation,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
_ConversationListItemState createState() => _ConversationListItemState();
|
|
}
|
|
|
|
class _ConversationListItemState extends State<ConversationListItem> {
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (context){
|
|
return ConversationDetail(
|
|
conversation: widget.conversation,
|
|
);
|
|
}));
|
|
},
|
|
child: Container(
|
|
padding: const EdgeInsets.only(left: 16,right: 16,top: 10,bottom: 10),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Row(
|
|
children: <Widget>[
|
|
CustomCircleAvatar(
|
|
initials: widget.conversation.name[0].toUpperCase(),
|
|
imagePath: null,
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: Container(
|
|
color: Colors.transparent,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Text(
|
|
widget.conversation.name,
|
|
style: const TextStyle(fontSize: 16)
|
|
),
|
|
//Text(widget.messageText,style: TextStyle(fontSize: 13,color: Colors.grey.shade600, fontWeight: widget.isMessageRead?FontWeight.bold:FontWeight.normal),),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|