show deleted and system messages in italic

This commit is contained in:
Salvatore Giordano
2020-07-08 15:10:17 +02:00
parent 86ea7b7e28
commit 446b051d03
+8 -6
View File
@@ -76,16 +76,15 @@ class ChannelPreview extends StatelessWidget {
Flexible(child: _buildSubtitle(context)), Flexible(child: _buildSubtitle(context)),
Builder( Builder(
builder: (context) { builder: (context) {
final lastMessage = channel.state.messages.last; if (channel.state.lastMessage?.user?.id ==
if (channel.state?.messages?.isNotEmpty == true && StreamChat.of(context).user.id) {
lastMessage.user.id == StreamChat.of(context).user.id) {
return Padding( return Padding(
padding: const EdgeInsets.only(right: 4.0), padding: const EdgeInsets.only(right: 4.0),
child: SendingIndicator( child: SendingIndicator(
message: lastMessage, message: channel.state.lastMessage,
allRead: channel.state.read allRead: channel.state.read
.where((element) => .where((element) => element.lastRead
element.lastRead.isAfter(lastMessage.createdAt)) .isAfter(channel.state.lastMessage.createdAt))
.length == .length ==
channel.memberCount - 1, channel.memberCount - 1,
), ),
@@ -189,6 +188,9 @@ class ChannelPreview extends StatelessWidget {
.subtitle .subtitle
.color .color
.withOpacity(0.5), .withOpacity(0.5),
fontStyle: (lastMessage.isSystem || lastMessage.isDeleted)
? FontStyle.italic
: FontStyle.normal,
), ),
); );
}, },