Use black avatar color for collect photos
This commit is contained in:
parent
eb4c449b58
commit
820461919c
2 changed files with 9 additions and 8 deletions
|
@ -26,10 +26,13 @@ class UserAvatarWidget extends StatelessWidget {
|
|||
final displayChar = (user.name == null || user.name!.isEmpty)
|
||||
? ((user.email.isEmpty) ? " " : user.email.substring(0, 1))
|
||||
: user.name!.substring(0, 1);
|
||||
final randomColor = colorScheme.avatarColors[
|
||||
(user.id ?? 0).remainder(colorScheme.avatarColors.length)];
|
||||
final Color decorationColor =
|
||||
((user.id ?? -1) == currentUserID) ? Colors.black : randomColor;
|
||||
Color decorationColor;
|
||||
if (user.id == null || user.id! <= 0 || user.id == currentUserID) {
|
||||
decorationColor = Colors.black;
|
||||
} else {
|
||||
decorationColor = colorScheme
|
||||
.avatarColors[(user.id!).remainder(colorScheme.avatarColors.length)];
|
||||
}
|
||||
|
||||
final avatarStyle = getAvatarStyle(context, type);
|
||||
final double size = avatarStyle.item1;
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'package:photos/db/files_db.dart';
|
|||
import 'package:photos/db/trash_db.dart';
|
||||
import 'package:photos/events/files_updated_event.dart';
|
||||
import 'package:photos/events/local_photos_updated_event.dart';
|
||||
import 'package:photos/extensions/string_ext.dart';
|
||||
import 'package:photos/models/collection.dart';
|
||||
import 'package:photos/models/file.dart';
|
||||
import 'package:photos/models/file_type.dart';
|
||||
|
@ -128,11 +127,10 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
|
|||
);
|
||||
} else if (widget.file!.pubMagicMetadata!.uploaderName != null) {
|
||||
contentChildren.add(
|
||||
// Use uploadName hashCode as userID so that different uploader
|
||||
// get avatar color
|
||||
// Use -1 as userID for enforcing black avatar color
|
||||
OwnerAvatarOverlayIcon(
|
||||
User(
|
||||
id: widget.file!.pubMagicMetadata!.uploaderName.sumAsciiValues,
|
||||
id: -1,
|
||||
email: '',
|
||||
name: widget.file!.pubMagicMetadata!.uploaderName,
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue