import 'dart:convert'; import 'package:azlistview/azlistview.dart'; import 'package:prime_chat/basic/Method.dart'; /// 图片 class RemoteImageInfo { // String originalName; String path; String fileServer; RemoteImageInfo( {required this.path, this.fileServer = "$api/file/"}); RemoteImageInfo.mock() : path = "", fileServer = ""; RemoteImageInfo.fromJson(Map json) : // this.originalName = json["originalName"], path = json["path"], fileServer = json["fileServer"]; } class FriendInfo extends UserProfile with ISuspensionBean { String? tagIndex; FriendInfo({required super.name, super.avatar, this.tagIndex}); @override String getSuspensionTag() => tagIndex ?? name.substring(0, 1); // toJson() => {"username": username, "uid": uid}; // @override // String toString() => jsonEncode(this); } /// 用户自己的信息 class UserProfile { String name; final RemoteImageInfo? _avatar; UserProfile({required this.name, RemoteImageInfo? avatar}): _avatar = avatar; RemoteImageInfo get avatar => _avatar ?? RemoteImageInfo.mock(); UserProfile.fromJson(Map json) : name = json["Name"], _avatar = RemoteImageInfo(path: json["Avatar"]); }