From 5c10e96a7b902cfbecca2683bf8d3e88dde214d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Rodr=C3=ADguez?= Date: Sun, 29 Jan 2023 10:29:25 -0500 Subject: [PATCH] fix: avatar color --- lib/pages/chat/events/message.dart | 2 +- lib/utils/string_color.dart | 7 ++++++- lib/widgets/avatar.dart | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index 1bc18675..4f21fd6a 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -168,7 +168,7 @@ class Message extends StatelessWidget { color: (Theme.of(context).brightness == Brightness.light ? displayname.color - : displayname.lightColor), + : displayname.lightColorText), ), ); }), diff --git a/lib/utils/string_color.dart b/lib/utils/string_color.dart index 9cad2313..b3c251b3 100644 --- a/lib/utils/string_color.dart +++ b/lib/utils/string_color.dart @@ -22,8 +22,13 @@ extension StringColor on String { return _colorCache[this]![0.2] ??= _getColorLight(0.2); } - Color get lightColor { + Color get lightColorText { _colorCache[this] ??= {}; return _colorCache[this]![0.7] ??= _getColorLight(0.7); } + + Color get lightColorAvatar { + _colorCache[this] ??= {}; + return _colorCache[this]![0.4] ??= _getColorLight(0.4); + } } diff --git a/lib/widgets/avatar.dart b/lib/widgets/avatar.dart index ca13564c..e112e664 100644 --- a/lib/widgets/avatar.dart +++ b/lib/widgets/avatar.dart @@ -58,8 +58,9 @@ class Avatar extends StatelessWidget { child: Container( width: size, height: size, - color: - noPic ? name?.lightColor : Theme.of(context).secondaryHeaderColor, + color: noPic + ? name?.lightColorAvatar + : Theme.of(context).secondaryHeaderColor, child: noPic ? textWidget : MxcImage(