Using only SendingIndicatorBuilder (rename from SendingIndicatorWrapper)

This commit is contained in:
Leandro Borges Ferreira
2023-02-15 17:33:23 +01:00
parent 6d97b8ac76
commit 06542da156
4 changed files with 25 additions and 12 deletions
@@ -204,7 +204,7 @@ class BottomRow extends StatelessWidget {
if (showSendingIndicator)
WidgetSpan(
child: sendingIndicatorBuilder?.call(context, message) ??
SendingIndicatorWrapper(
SendingIndicatorBuilder(
messageTheme: messageTheme,
message: message,
hasNonUrlAttachments: hasNonUrlAttachments,
@@ -6,15 +6,16 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
///
/// Used in [BottomRow]. Should not be used elsewhere.
/// {@endtemplate}
class SendingIndicatorWrapper extends StatelessWidget {
class SendingIndicatorBuilder extends StatelessWidget {
/// {@macro sendingIndicatorWrapper}
const SendingIndicatorWrapper({
const SendingIndicatorBuilder({
super.key,
required this.messageTheme,
required this.message,
required this.hasNonUrlAttachments,
required this.streamChat,
required this.streamChatTheme,
this.channel,
});
/// {@macro messageTheme}
@@ -32,10 +33,13 @@ class SendingIndicatorWrapper extends StatelessWidget {
/// {@macro streamChatThemeData}
final StreamChatThemeData streamChatTheme;
final Channel? channel;
@override
Widget build(BuildContext context) {
final style = messageTheme.createdAtStyle;
final memberCount = StreamChannel.of(context).channel.memberCount ?? 0;
final thisChannel = channel ?? StreamChannel.of(context).channel;
final memberCount = thisChannel.memberCount ?? 0;
if (hasNonUrlAttachments &&
(message.status == MessageSendingStatus.sending ||
@@ -58,11 +62,9 @@ class SendingIndicatorWrapper extends StatelessWidget {
);
}
final channel = StreamChannel.of(context).channel;
return BetterStreamBuilder<List<Read>>(
stream: channel.state?.readStream,
initialData: channel.state?.read,
stream: thisChannel.state?.readStream,
initialData: thisChannel.state?.read,
builder: (context, data) {
final readList = data.where((it) =>
it.user.id != streamChat.currentUser?.id &&