Entities.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import 'dart:convert';
  2. import 'package:azlistview/azlistview.dart';
  3. import 'package:prime_chat/basic/Method.dart';
  4. /// 图片
  5. class RemoteImageInfo {
  6. // String originalName;
  7. String path;
  8. String fileServer;
  9. RemoteImageInfo(
  10. {required this.path, this.fileServer = "$api/file/"});
  11. RemoteImageInfo.mock() : path = "", fileServer = "";
  12. RemoteImageInfo.fromJson(Map<String, dynamic> json) :
  13. // this.originalName = json["originalName"],
  14. path = json["path"],
  15. fileServer = json["fileServer"];
  16. }
  17. class FriendInfo extends UserProfile with ISuspensionBean {
  18. String? tagIndex;
  19. FriendInfo({required super.name, super.avatar, this.tagIndex});
  20. @override
  21. String getSuspensionTag() => tagIndex ?? name.substring(0, 1);
  22. // toJson() => {"username": username, "uid": uid};
  23. // @override
  24. // String toString() => jsonEncode(this);
  25. }
  26. /// 用户自己的信息
  27. class UserProfile {
  28. String name;
  29. final RemoteImageInfo? _avatar;
  30. UserProfile({required this.name, RemoteImageInfo? avatar}): _avatar = avatar;
  31. RemoteImageInfo get avatar => _avatar ?? RemoteImageInfo.mock();
  32. UserProfile.fromJson(Map<String, dynamic> json)
  33. : name = json["Name"],
  34. _avatar = RemoteImageInfo(path: json["Avatar"]);
  35. }