mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
Implemented user profile upload and show on web/mobile (#191)
* Update mobile dependencies * Added image picker * Added mechanism to upload profile image * Added image type to send to web * Added styling for circle avatar * Fixxed issue with sharp cannot resize image properly * Finished displaying and uploading user profile * Added user profile to web
This commit is contained in:
parent
bdf38e7668
commit
d476b15312
17 changed files with 579 additions and 86 deletions
|
|
@ -0,0 +1,53 @@
|
|||
import 'dart:convert';
|
||||
|
||||
class UploadProfileImageResponse {
|
||||
final String userId;
|
||||
final String profileImagePath;
|
||||
UploadProfileImageResponse({
|
||||
required this.userId,
|
||||
required this.profileImagePath,
|
||||
});
|
||||
|
||||
UploadProfileImageResponse copyWith({
|
||||
String? userId,
|
||||
String? profileImagePath,
|
||||
}) {
|
||||
return UploadProfileImageResponse(
|
||||
userId: userId ?? this.userId,
|
||||
profileImagePath: profileImagePath ?? this.profileImagePath,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
final result = <String, dynamic>{};
|
||||
|
||||
result.addAll({'userId': userId});
|
||||
result.addAll({'profileImagePath': profileImagePath});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
factory UploadProfileImageResponse.fromMap(Map<String, dynamic> map) {
|
||||
return UploadProfileImageResponse(
|
||||
userId: map['userId'] ?? '',
|
||||
profileImagePath: map['profileImagePath'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory UploadProfileImageResponse.fromJson(String source) => UploadProfileImageResponse.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() => 'UploadProfileImageReponse(userId: $userId, profileImagePath: $profileImagePath)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is UploadProfileImageResponse && other.userId == userId && other.profileImagePath == profileImagePath;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => userId.hashCode ^ profileImagePath.hashCode;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue