AI助手优化-头像和对话功能
This commit is contained in:
@@ -3,12 +3,21 @@ class AuthResponse {
|
||||
final String? username;
|
||||
final String? nickname;
|
||||
|
||||
const AuthResponse({required this.token, this.username, this.nickname});
|
||||
/// 头像相对路径。null = 用默认头像
|
||||
final String? avatar;
|
||||
|
||||
const AuthResponse({
|
||||
required this.token,
|
||||
this.username,
|
||||
this.nickname,
|
||||
this.avatar,
|
||||
});
|
||||
|
||||
factory AuthResponse.fromJson(Map<String, dynamic> json) => AuthResponse(
|
||||
token: json['token']?.toString() ?? '',
|
||||
username: json['username']?.toString(),
|
||||
nickname: json['nickname']?.toString(),
|
||||
avatar: json['avatar']?.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,13 +26,27 @@ class UserInfo {
|
||||
final String username;
|
||||
final String nickname;
|
||||
|
||||
const UserInfo({this.id, required this.username, required this.nickname});
|
||||
/// 头像相对路径。null = 用默认头像
|
||||
final String? avatar;
|
||||
|
||||
Map<String, dynamic> toJson() => {'id': id, 'username': username, 'nickname': nickname};
|
||||
const UserInfo({
|
||||
this.id,
|
||||
required this.username,
|
||||
required this.nickname,
|
||||
this.avatar,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'username': username,
|
||||
'nickname': nickname,
|
||||
'avatar': avatar,
|
||||
};
|
||||
|
||||
factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
|
||||
id: json['id']?.toString(),
|
||||
username: json['username']?.toString() ?? '',
|
||||
nickname: json['nickname']?.toString() ?? '',
|
||||
avatar: json['avatar']?.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user