Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.9 KiB

  1. import 'package:Envelope/components/custom_circle_avatar.dart';
  2. import 'package:Envelope/models/conversations.dart';
  3. import 'package:flutter/material.dart';
  4. import '/views/main/conversation_detail.dart';
  5. class ConversationListItem extends StatefulWidget{
  6. final Conversation conversation;
  7. const ConversationListItem({
  8. Key? key,
  9. required this.conversation,
  10. }) : super(key: key);
  11. @override
  12. _ConversationListItemState createState() => _ConversationListItemState();
  13. }
  14. class _ConversationListItemState extends State<ConversationListItem> {
  15. @override
  16. Widget build(BuildContext context) {
  17. return GestureDetector(
  18. onTap: () {
  19. Navigator.push(context, MaterialPageRoute(builder: (context){
  20. return ConversationDetail(
  21. conversation: widget.conversation,
  22. );
  23. }));
  24. },
  25. child: Container(
  26. padding: const EdgeInsets.only(left: 16,right: 16,top: 10,bottom: 10),
  27. child: Row(
  28. children: <Widget>[
  29. Expanded(
  30. child: Row(
  31. children: <Widget>[
  32. CustomCircleAvatar(
  33. initials: widget.conversation.name[0].toUpperCase(),
  34. imagePath: null,
  35. ),
  36. const SizedBox(width: 16),
  37. Expanded(
  38. child: Align(
  39. alignment: Alignment.centerLeft,
  40. child: Container(
  41. color: Colors.transparent,
  42. child: Column(
  43. crossAxisAlignment: CrossAxisAlignment.start,
  44. children: <Widget>[
  45. Text(
  46. widget.conversation.name,
  47. style: const TextStyle(fontSize: 16)
  48. ),
  49. //Text(widget.messageText,style: TextStyle(fontSize: 13,color: Colors.grey.shade600, fontWeight: widget.isMessageRead?FontWeight.bold:FontWeight.normal),),
  50. ],
  51. ),
  52. ),
  53. ),
  54. ),
  55. ],
  56. ),
  57. ),
  58. ],
  59. ),
  60. ),
  61. );
  62. }
  63. }