fix: Design of invite rooms

This commit is contained in:
Christian Pauly 2021-08-13 12:39:42 +02:00
parent 8cfe2a1899
commit aa308647c8
1 changed files with 22 additions and 28 deletions

View File

@ -149,7 +149,8 @@ class ChatListItem extends StatelessWidget {
final typingText = room.getLocalizedTypingText(context); final typingText = room.getLocalizedTypingText(context);
final ownMessage = final ownMessage =
room.lastEvent?.senderId == Matrix.of(context).client.userID; room.lastEvent?.senderId == Matrix.of(context).client.userID;
final unreadBubbleSize = room.isUnread final unread = room.isUnread || room.membership == Membership.invite;
final unreadBubbleSize = unread
? room.notificationCount > 0.0 ? room.notificationCount > 0.0
? 20.0 ? 20.0
: 14.0 : 14.0
@ -180,8 +181,8 @@ class ChatListItem extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
softWrap: false, softWrap: false,
style: TextStyle( style: TextStyle(
fontWeight: room.isUnread ? FontWeight.bold : null, fontWeight: unread ? FontWeight.bold : null,
color: room.isUnread color: unread
? Theme.of(context).colorScheme.secondary ? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText1.color, : Theme.of(context).textTheme.bodyText1.color,
), ),
@ -211,7 +212,7 @@ class ChatListItem extends StatelessWidget {
room.timeCreated.localizedTimeShort(context), room.timeCreated.localizedTimeShort(context),
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: room.isUnread color: unread
? Theme.of(context).colorScheme.secondary ? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText2.color, : Theme.of(context).textTheme.bodyText2.color,
), ),
@ -264,33 +265,26 @@ class ChatListItem extends StatelessWidget {
), ),
softWrap: false, softWrap: false,
) )
: room.membership == Membership.invite : Text(
? Text( room.membership == Membership.invite
L10n.of(context).youAreInvitedToThisChat, ? L10n.of(context).youAreInvitedToThisChat
style: TextStyle( : room.lastEvent?.getLocalizedBody(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
softWrap: false,
)
: Text(
room.lastEvent?.getLocalizedBody(
MatrixLocals(L10n.of(context)), MatrixLocals(L10n.of(context)),
hideReply: true, hideReply: true,
) ?? ) ??
'', '',
softWrap: false, softWrap: false,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: room.isUnread color: unread
? Theme.of(context).colorScheme.secondary ? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText2.color, : Theme.of(context).textTheme.bodyText2.color,
decoration: room.lastEvent?.redacted == true decoration: room.lastEvent?.redacted == true
? TextDecoration.lineThrough ? TextDecoration.lineThrough
: null, : null,
), ),
), ),
), ),
SizedBox(width: 8), SizedBox(width: 8),
AnimatedContainer( AnimatedContainer(
@ -298,7 +292,7 @@ class ChatListItem extends StatelessWidget {
curve: Curves.bounceInOut, curve: Curves.bounceInOut,
padding: EdgeInsets.symmetric(horizontal: 7), padding: EdgeInsets.symmetric(horizontal: 7),
height: unreadBubbleSize, height: unreadBubbleSize,
width: room.notificationCount == 0 && !room.isUnread width: room.notificationCount == 0 && !unread
? 0 ? 0
: (unreadBubbleSize - 10) * : (unreadBubbleSize - 10) *
room.notificationCount.toString().length + room.notificationCount.toString().length +