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
+11 -9
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()}', }
style: StreamChatTheme.of(context) final jiffyDate = Jiffy(snapshot.data?.toLocal());
.channelTheme return Text(
.channelHeaderTheme 'Active ${jiffyDate.isBefore(Jiffy()) ? jiffyDate.fromNow() : 'now'}',
.lastMessageAt, style: StreamChatTheme.of(context)
) .channelTheme
: SizedBox(); .channelHeaderTheme
.lastMessageAt,
);
}, },
); );
} }