fix last active on new message

This commit is contained in:
Salvatore Giordano
2020-09-21 17:17:13 +02:00
parent a8c4d5709b
commit 293ad5c9bf
+7 -5
View File
@@ -120,15 +120,17 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
stream: channel.lastMessageAtStream, stream: channel.lastMessageAtStream,
initialData: channel.lastMessageAt, initialData: channel.lastMessageAt,
builder: (context, snapshot) { builder: (context, snapshot) {
return (snapshot.data != null) if (snapshot.data == null) {
? Text( return SizedBox();
'Active ${Jiffy(snapshot.data.toLocal()).fromNow()}', }
final jiffyDate = Jiffy(snapshot.data?.toLocal());
return Text(
'Active ${jiffyDate.isBefore(Jiffy()) ? jiffyDate.fromNow() : 'now'}',
style: StreamChatTheme.of(context) style: StreamChatTheme.of(context)
.channelTheme .channelTheme
.channelHeaderTheme .channelHeaderTheme
.lastMessageAt, .lastMessageAt,
) );
: SizedBox();
}, },
); );
} }