add unread indicator

This commit is contained in:
Salvatore Giordano
2020-04-24 16:12:11 +02:00
parent 5df6c303ff
commit c3a068a4b4
4 changed files with 37 additions and 10 deletions
+28
View File
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
class UnreadIndicator extends StatelessWidget {
const UnreadIndicator({
Key key,
@required this.channel,
}) : super(key: key);
final Channel channel;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 8.0),
child: CircleAvatar(
backgroundColor:
StreamChatTheme.of(context).channelPreviewTheme.unreadCounterColor,
radius: 6,
child: Text(
'${channel.state.unreadCount}',
style: TextStyle(fontSize: 8),
),
),
);
}
}