Merge branch 'develop' into overlay-alt

This commit is contained in:
Salvatore Giordano
2021-09-20 12:07:56 +02:00
committed by GitHub
3 changed files with 56 additions and 4 deletions
@@ -6,6 +6,7 @@
there are no actions available to show.
- [[#349]](https://github.com/GetStream/stream-chat-flutter/issues/349): Fix `MessageInput` attachment render overflow error.
- `MessageInput` overlays now follow the `MessageInput` focus.
- [[#674]](https://github.com/GetStream/stream-chat-flutter/issues/674): Check scrollController is attached before calling jump in MessageListView.
🔄 Changed
@@ -1199,10 +1199,12 @@ class _MessageListViewState extends State<MessageListView> {
initialAlignment = _initialAlignment;
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
_scrollController?.jumpTo(
index: initialIndex,
alignment: initialAlignment,
);
if (_scrollController?.isAttached == true) {
_scrollController?.jumpTo(
index: initialIndex,
alignment: initialAlignment,
);
}
});
_messageNewListener =
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'mocks.dart';
void main() {
late StreamChatClient client;
late Channel channel;
setUp(() {
client = MockClient();
channel = MockChannel();
when(() => channel.on(any(), any(), any(), any()))
.thenAnswer((_) => const Stream.empty());
final channelClientState = MockChannelState();
when(() => channel.state).thenReturn(channelClientState);
when(() => channelClientState.threadsStream)
.thenAnswer((_) => const Stream.empty());
when(() => channelClientState.messagesStream)
.thenAnswer((_) => const Stream.empty());
when(() => channelClientState.messages).thenReturn([]);
when(() => channelClientState.isUpToDate).thenReturn(true);
});
// https://github.com/GetStream/stream-chat-flutter/issues/674
testWidgets('renders empty message list view', (tester) async {
const emptyWidgetKey = Key('empty_widget');
await tester.pumpWidget(
MaterialApp(
home: StreamChat(
client: client,
child: StreamChannel(
channel: channel,
child: MessageListView(
emptyBuilder: (_) => Container(key: emptyWidgetKey),
),
),
),
),
);
await tester.pumpAndSettle();
expect(find.byType(MessageListView), findsOneWidget);
expect(find.byKey(emptyWidgetKey), findsOneWidget);
});
}