diff --git a/lib/components/avatar.dart b/lib/components/avatar.dart index d6c7008..c3d55a5 100644 --- a/lib/components/avatar.dart +++ b/lib/components/avatar.dart @@ -48,7 +48,7 @@ class Avatar extends StatelessWidget { ) : null, backgroundColor: noPic - ? name?.color ?? Theme.of(context).secondaryHeaderColor + ? name?.lightColor ?? Theme.of(context).secondaryHeaderColor : Theme.of(context).secondaryHeaderColor, child: noPic ? Text(fallbackLetters, style: TextStyle(color: Colors.white)) diff --git a/lib/utils/string_color.dart b/lib/utils/string_color.dart index 63ae28a..f96c2e1 100644 --- a/lib/utils/string_color.dart +++ b/lib/utils/string_color.dart @@ -2,6 +2,15 @@ import 'package:flutter/material.dart'; extension StringColor on String { Color get color { + var number = 0.0; + for (var i = 0; i < length; i++) { + number += codeUnitAt(i); + } + number = (number % 10) * 25.5; + return HSLColor.fromAHSL(1, number, 1, 0.35).toColor(); + } + + Color get lightColor { var number = 0.0; for (var i = 0; i < length; i++) { number += codeUnitAt(i); diff --git a/lib/views/chat_list.dart b/lib/views/chat_list.dart index ef2fdf8..be5f041 100644 --- a/lib/views/chat_list.dart +++ b/lib/views/chat_list.dart @@ -298,7 +298,8 @@ class _ChatListState extends State { title: selectMode == SelectMode.share ? Text(L10n.of(context).share) : Padding( - padding: EdgeInsets.all(8), + padding: + EdgeInsets.only(top: 8, bottom: 8, right: 8), child: TextField( autocorrect: false, controller: searchController,