fix: Selected chat list item color

This commit is contained in:
Christian Pauly 2021-08-04 09:35:38 +02:00
parent 496ad03901
commit 9a78b8ad85
2 changed files with 13 additions and 20 deletions

View File

@ -209,18 +209,6 @@ abstract class FluffyThemes {
), ),
); );
static Color chatListItemColor(
BuildContext context, bool activeChat, bool selected) =>
selected
? Theme.of(context).primaryColor.withAlpha(100)
: Theme.of(context).brightness == Brightness.light
? activeChat
? Color(0xFFE8E8E8)
: Colors.white
: activeChat
? Color(0xff121212)
: Colors.black;
static Color blackWhiteColor(BuildContext context) => static Color blackWhiteColor(BuildContext context) =>
Theme.of(context).brightness == Brightness.light Theme.of(context).brightness == Brightness.light
? Colors.white ? Colors.white

View File

@ -2,7 +2,6 @@ import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/event_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions.dart/event_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions.dart/matrix_locals.dart';
import 'package:fluffychat/utils/room_status_extension.dart'; import 'package:fluffychat/utils/room_status_extension.dart';
@ -147,9 +146,10 @@ class ChatListItem extends StatelessWidget {
: 14.0 : 14.0
: 0.0; : 0.0;
return ListTile( return ListTile(
selected: selected, selected: selected || activeChat,
selectedTileColor: selectedTileColor: selected
FluffyThemes.chatListItemColor(context, activeChat, selected), ? Theme.of(context).primaryColor.withAlpha(100)
: Theme.of(context).secondaryHeaderColor,
onLongPress: onLongPress, onLongPress: onLongPress,
leading: selected leading: selected
? Container( ? Container(
@ -170,6 +170,12 @@ class ChatListItem extends StatelessWidget {
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
softWrap: false, softWrap: false,
style: TextStyle(
fontWeight: room.isUnread ? FontWeight.bold : null,
color: room.isUnread
? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText1.color,
),
), ),
), ),
if (isMuted) if (isMuted)
@ -196,9 +202,9 @@ class ChatListItem extends StatelessWidget {
room.timeCreated.localizedTimeShort(context), room.timeCreated.localizedTimeShort(context),
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: room.notificationCount > 0 color: room.isUnread
? Theme.of(context).colorScheme.secondary ? Theme.of(context).colorScheme.secondary
: null, : Theme.of(context).textTheme.bodyText2.color,
), ),
), ),
), ),
@ -270,8 +276,7 @@ class ChatListItem extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: room.isUnread color: room.isUnread
? Theme.of(context).colorScheme.secondary ? Theme.of(context).colorScheme.secondary
: null, : Theme.of(context).textTheme.bodyText2.color,
fontWeight: room.isUnread ? FontWeight.bold : null,
decoration: room.lastEvent?.redacted == true decoration: room.lastEvent?.redacted == true
? TextDecoration.lineThrough ? TextDecoration.lineThrough
: null, : null,