conflict changes

This commit is contained in:
shalong-tanwen 2023-11-13 16:47:09 +05:30
parent f249a3761b
commit 543ff6f7fd
2 changed files with 32 additions and 5 deletions

View file

@ -47,6 +47,7 @@ class User {
profileImagePath = dto.profileImagePath,
isAdmin = dto.isAdmin,
memoryEnabled = dto.memoriesEnabled,
avatarColor = dto.avatarColor.toAvatarColor(),
inTimeline = dto.inTimeline;
@Index(unique: true, replace: false, type: IndexType.hash)
@ -113,7 +114,7 @@ enum AvatarColorEnum {
amber,
}
extension AvatarColorEnumHelper on UserResponseDtoAvatarColorEnum {
extension UserResponseAvatarColorEnumHelper on UserResponseDtoAvatarColorEnum {
AvatarColorEnum toAvatarColor() {
switch (this) {
case UserResponseDtoAvatarColorEnum.primary:
@ -141,6 +142,35 @@ extension AvatarColorEnumHelper on UserResponseDtoAvatarColorEnum {
}
}
extension PartnerResponseAvatarColorEnumHelper
on PartnerResponseDtoAvatarColorEnum {
AvatarColorEnum toAvatarColor() {
switch (this) {
case PartnerResponseDtoAvatarColorEnum.primary:
return AvatarColorEnum.primary;
case PartnerResponseDtoAvatarColorEnum.pink:
return AvatarColorEnum.pink;
case PartnerResponseDtoAvatarColorEnum.red:
return AvatarColorEnum.red;
case PartnerResponseDtoAvatarColorEnum.yellow:
return AvatarColorEnum.yellow;
case PartnerResponseDtoAvatarColorEnum.blue:
return AvatarColorEnum.blue;
case PartnerResponseDtoAvatarColorEnum.green:
return AvatarColorEnum.green;
case PartnerResponseDtoAvatarColorEnum.purple:
return AvatarColorEnum.purple;
case PartnerResponseDtoAvatarColorEnum.orange:
return AvatarColorEnum.orange;
case PartnerResponseDtoAvatarColorEnum.gray:
return AvatarColorEnum.gray;
case PartnerResponseDtoAvatarColorEnum.amber:
return AvatarColorEnum.amber;
}
return AvatarColorEnum.primary;
}
}
extension AvatarColorToColorHelper on AvatarColorEnum {
Color toColor([bool isDarkTheme = false]) {
switch (this) {

View file

@ -3,7 +3,6 @@ import 'dart:math';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/shared/models/store.dart';
import 'package:immich_mobile/shared/models/user.dart';
import 'package:immich_mobile/shared/ui/transparent_image.dart';
@ -37,9 +36,7 @@ class UserCircleAvatar extends ConsumerWidget {
),
);
return CircleAvatar(
backgroundColor: useRandomBackgroundColor
? randomColors[Random().nextInt(randomColors.length)]
: context.primaryColor,
backgroundColor: user.avatarColor.toColor(),
radius: radius,
child: user.profileImagePath.isEmpty
? textIcon