fix rebuild message list view
This commit is contained in:
@@ -3,10 +3,10 @@ analyzer:
|
||||
- extension-methods
|
||||
exclude:
|
||||
- lib/**/*.g.dart
|
||||
- example/**
|
||||
# - example/**
|
||||
- lib/src/emoji
|
||||
- lib/**/*.freezed.dart
|
||||
- test/**
|
||||
# - test/**
|
||||
|
||||
linter:
|
||||
rules:
|
||||
|
||||
@@ -27,7 +27,6 @@ class ChannelInfo extends StatelessWidget {
|
||||
final client = StreamChat.of(context).client;
|
||||
return StreamBuilder<List<Member>>(
|
||||
stream: channel.state?.membersStream,
|
||||
initialData: channel.state?.members,
|
||||
builder: (context, snapshot) => ConnectionStatusBuilder(
|
||||
statusBuilder: (context, status) {
|
||||
switch (status) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
@@ -39,7 +40,6 @@ class ConnectionStatusBuilder extends StatelessWidget {
|
||||
final stream = connectionStatusStream ??
|
||||
StreamChat.of(context).client.wsConnectionStatusStream;
|
||||
return StreamBuilder<ConnectionStatus>(
|
||||
initialData: initialStatus,
|
||||
stream: stream,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
|
||||
@@ -690,7 +690,7 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
? streamChannel.queryTopMessages
|
||||
: streamChannel.queryBottomMessages;
|
||||
return StreamBuilder<bool>(
|
||||
key: const Key('LOADING-INDICATOR'),
|
||||
key: Key('LOADING-INDICATOR $direction'),
|
||||
stream: stream,
|
||||
initialData: false,
|
||||
builder: (context, snapshot) {
|
||||
@@ -789,7 +789,9 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
}
|
||||
}
|
||||
if (mounted) {
|
||||
setState(() => _showScrollToBottom = !isVisible);
|
||||
if (_showScrollToBottom == isVisible) {
|
||||
setState(() => _showScrollToBottom = !isVisible);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: messageWidget,
|
||||
|
||||
@@ -33,8 +33,15 @@ class TypingIndicator extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final channelState =
|
||||
channel?.state ?? StreamChannel.of(context).channel.state!;
|
||||
|
||||
final altWidget = Align(
|
||||
key: const Key('alternative'),
|
||||
alignment: alignment,
|
||||
child: Container(
|
||||
child: alternativeWidget ?? const Offstage(),
|
||||
),
|
||||
);
|
||||
return StreamBuilder<List<User>>(
|
||||
initialData: channelState.typingEvents,
|
||||
stream: channelState.typingEventsStream,
|
||||
builder: (context, snapshot) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
@@ -62,13 +69,7 @@ class TypingIndicator extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
)
|
||||
: Align(
|
||||
key: const Key('alternative'),
|
||||
alignment: alignment,
|
||||
child: Container(
|
||||
child: alternativeWidget ?? const Offstage(),
|
||||
),
|
||||
),
|
||||
: altWidget,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user