message_model.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import 'package:e2ee_chat/common/global.dart';
  2. import 'package:flutter/cupertino.dart';
  3. enum DTMessageType {
  4. text,
  5. image
  6. }
  7. class MessageListModel extends ChangeNotifier {
  8. List items = <MessageItemModel>[];
  9. int get count => items.length;
  10. }
  11. class MessageItemModel {
  12. MessageItemModel({required this.chatId,
  13. required this.userId,
  14. required this.userName,
  15. required this.chatName,
  16. required this.message,
  17. required this.messageType,
  18. required this.time,
  19. this.unReadCount = 0,
  20. this.isSingle = false,
  21. this.avatar,
  22. this.isGroup = false,
  23. this.isDisturbing = false,
  24. this.isSpecialAttention = false,
  25. this.isAtYou = false,
  26. this.isAtAll = false,
  27. this.isStick = false});
  28. /// 聊天 Id
  29. String chatId;
  30. /// 用户名称
  31. String userName;
  32. /// 用户Id
  33. String userId;
  34. /// 聊天名称
  35. String chatName;
  36. /// 消息体
  37. String message;
  38. /// message type
  39. DTMessageType messageType;
  40. /// 时间
  41. int time;
  42. /// 未读数量
  43. int unReadCount;
  44. /// 单聊
  45. bool isSingle;
  46. Image? avatar;
  47. /// 群聊信息
  48. bool isGroup;
  49. /// 消息免打扰
  50. bool isDisturbing;
  51. /// 是否为置顶
  52. bool isStick;
  53. /// 特别关注
  54. bool isSpecialAttention;
  55. /// 是否 @ 你
  56. bool isAtYou;
  57. /// 是否 @ 全部
  58. bool isAtAll;
  59. }