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.

68 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. behavior: HitTestBehavior.opaque,
  19. onTap: () {
  20. Navigator.push(context, MaterialPageRoute(builder: (context){
  21. return ConversationDetail(
  22. conversation: widget.conversation,
  23. );
  24. }));
  25. },
  26. child: Container(
  27. padding: const EdgeInsets.only(left: 16,right: 16,top: 10,bottom: 10),
  28. child: Row(
  29. children: <Widget>[
  30. Expanded(
  31. child: Row(
  32. children: <Widget>[
  33. CustomCircleAvatar(
  34. initials: widget.conversation.name[0].toUpperCase(),
  35. imagePath: null,
  36. ),
  37. const SizedBox(width: 16),
  38. Expanded(
  39. child: Align(
  40. alignment: Alignment.centerLeft,
  41. child: Container(
  42. color: Colors.transparent,
  43. child: Column(
  44. crossAxisAlignment: CrossAxisAlignment.start,
  45. children: <Widget>[
  46. Text(
  47. widget.conversation.name,
  48. style: const TextStyle(fontSize: 16)
  49. ),
  50. //Text(widget.messageText,style: TextStyle(fontSize: 13,color: Colors.grey.shade600, fontWeight: widget.isMessageRead?FontWeight.bold:FontWeight.normal),),
  51. ],
  52. ),
  53. ),
  54. ),
  55. ),
  56. ],
  57. ),
  58. ),
  59. ],
  60. ),
  61. ),
  62. );
  63. }
  64. }