Merge remote-tracking branch 'origin/v7.0.0'

This commit is contained in:
Efthymis Sarmpanis
2023-12-04 12:16:34 +02:00
188 changed files with 4662 additions and 4119 deletions
@@ -1,25 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import '../mocks.dart';
void main() {
testWidgets('AttachmentError test', (tester) async {
await tester.pumpWidget(
MaterialApp(
builder: (context, child) => StreamChat(
client: MockClient(),
child: child,
),
home: const Scaffold(
body: Center(
child: AttachmentError(),
),
),
),
);
expect(find.byType(Icon), findsOneWidget);
});
}
@@ -1,42 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import '../mocks.dart';
void main() {
testWidgets('AttachmentTitle renders properly', (tester) async {
final mockClient = MockClient();
await tester.pumpWidget(
MaterialApp(
builder: (context, child) => StreamChat(
client: mockClient,
streamChatThemeData: StreamChatThemeData.light(),
child: child,
),
home: Scaffold(
body: Builder(
builder: (context) {
return Center(
child: StreamAttachmentTitle(
attachment: Attachment(
title: 'Test Attachment',
type: 'video',
titleLink: 'https://www.youtube.com/watch?v=lytQi-slT5Y',
ogScrapeUrl: 'https://www.youtube.com/watch?v=lytQi-slT5Y',
),
messageTheme: StreamChatTheme.of(context).ownMessageTheme,
),
);
},
),
),
),
);
expect(find.byType(StreamAttachmentTitle), findsOneWidget);
expect(find.text('Test Attachment'), findsOneWidget);
expect(find.text('https://www.youtube.com/watch?v=lytQi-slT5Y'),
findsOneWidget);
});
}
@@ -30,7 +30,7 @@ void main() {
300,
)),
message: Message(),
attachment: Attachment(
file: Attachment(
type: 'file',
title: 'example.pdf',
extraData: const {
@@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:stream_chat_flutter/src/attachment/thumbnail/image_attachment_thumbnail.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import '../mocks.dart';
@@ -18,6 +19,27 @@ void main() {
final themeData = ThemeData();
final streamTheme = StreamChatThemeData.fromTheme(themeData);
final attachments = [
Attachment(
type: 'image',
title: 'example.png',
imageUrl:
'https://logowik.com/content/uploads/images/flutter5786.jpg',
extraData: const {
'mime_type': 'png',
},
),
Attachment(
type: 'image',
title: 'example.png',
imageUrl:
'https://logowik.com/content/uploads/images/flutter5786.jpg',
extraData: const {
'mime_type': 'png',
},
),
];
await tester.pumpWidget(
MaterialApp(
home: StreamChatTheme(
@@ -25,33 +47,23 @@ void main() {
child: StreamChannel(
channel: channel,
child: SizedBox(
child: StreamImageGroup(
messageTheme: streamTheme.ownMessageTheme,
child: StreamGalleryAttachment(
constraints: BoxConstraints.tight(const Size(
300,
300,
)),
message: Message(),
images: [
Attachment(
type: 'image',
title: 'example.png',
imageUrl:
'https://logowik.com/content/uploads/images/flutter5786.jpg',
extraData: const {
'mime_type': 'png',
},
),
Attachment(
type: 'image',
title: 'example.png',
imageUrl:
'https://logowik.com/content/uploads/images/flutter5786.jpg',
extraData: const {
'mime_type': 'png',
},
),
],
attachments: attachments,
itemBuilder: (context, index) {
final attachment = attachments[index];
return StreamImageAttachmentThumbnail(
image: attachment,
width: double.infinity,
height: double.infinity,
fit: BoxFit.cover,
);
},
),
),
),
@@ -30,7 +30,7 @@ void main() {
300,
)),
message: Message(),
attachment: Attachment(
giphy: Attachment(
type: 'giphy',
title: 'example.gif',
imageUrl:
@@ -26,13 +26,12 @@ void main() {
channel: channel,
child: SizedBox(
child: StreamImageAttachment(
messageTheme: streamTheme.ownMessageTheme,
constraints: BoxConstraints.tight(const Size(
300,
300,
)),
message: Message(),
attachment: Attachment(
image: Attachment(
type: 'image',
title: 'example.png',
imageUrl:
@@ -26,6 +26,7 @@ void main() {
child: SizedBox(
child: StreamUrlAttachment(
messageTheme: streamTheme.ownMessageTheme,
message: Message(),
hostDisplayName: 'Test',
urlAttachment: Attachment(
title: 'Flutter',
@@ -1,97 +0,0 @@
// ignore_for_file: deprecated_member_use_from_same_package
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() {
testWidgets(
'it should show basic channel information',
(WidgetTester tester) async {
final client = MockClient();
final clientState = MockClientState();
final channel = MockChannel();
final channelState = MockChannelState();
final user = OwnUser(id: 'user-id');
final lastMessageAt = DateTime.parse('2020-06-22 12:00:00');
when(() => channel.cid).thenReturn('cid');
when(() => client.state).thenReturn(clientState);
when(() => clientState.currentUser).thenReturn(user);
when(() => clientState.currentUserStream)
.thenAnswer((_) => Stream.value(user));
when(() => channel.lastMessageAtStream)
.thenAnswer((_) => Stream.value(lastMessageAt));
when(() => channel.lastMessageAt).thenReturn(lastMessageAt);
when(() => channel.state).thenReturn(channelState);
when(() => channel.client).thenReturn(client);
when(() => channel.isMuted).thenReturn(false);
when(() => channel.isMutedStream).thenAnswer((i) => Stream.value(false));
when(() => channel.nameStream)
.thenAnswer((i) => Stream.value('test name'));
when(() => channel.name).thenReturn('test name');
when(() => channel.imageStream)
.thenAnswer((i) => Stream.value('https://bit.ly/321RmWb'));
when(() => channel.image).thenReturn('https://bit.ly/321RmWb');
when(() => clientState.channels).thenReturn({
channel.cid!: channel,
});
when(() => channelState.unreadCount).thenReturn(1);
when(() => channelState.unreadCountStream)
.thenAnswer((i) => Stream.value(1));
when(() => channelState.membersStream).thenAnswer(
(i) => Stream.value([
Member(
userId: 'user-id',
user: User(id: 'user-id'),
)
]),
);
when(() => channelState.members).thenReturn([
Member(
userId: 'user-id',
user: User(id: 'user-id'),
),
]);
when(() => channelState.messages).thenReturn([
Message(
text: 'hello',
user: User(id: 'other-user'),
)
]);
when(() => channelState.messagesStream).thenAnswer(
(i) => Stream.value([
Message(
text: 'hello',
user: User(id: 'other-user'),
)
]),
);
await tester.pumpWidget(
MaterialApp(
home: StreamChat(
client: client,
child: StreamChannel(
channel: channel,
child: Scaffold(
body: ChannelPreview(
channel: channel,
),
),
),
),
),
);
expect(find.text('6/22/2020'), findsOneWidget);
expect(find.text('test name'), findsOneWidget);
expect(find.text('1'), findsOneWidget);
expect(find.text('hello'), findsOneWidget);
expect(find.byType(StreamChannelAvatar), findsOneWidget);
},
);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:stream_chat_flutter/src/attachment/thumbnail/media_attachment_thumbnail.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import '../mocks.dart';
@@ -37,7 +38,9 @@ void main() {
// Expect 2 file attachments and 1 media attachment
expect(find.byType(MessageInputFileAttachments), findsOneWidget);
expect(find.byType(StreamFileAttachment), findsNWidgets(2));
expect(find.byType(MessageInputMediaAttachments), findsOneWidget);
expect(find.byType(StreamMediaAttachmentThumbnail), findsOneWidget);
},
);
@@ -111,7 +114,7 @@ void main() {
);
// Expect 2 file attachments
expect(find.byType(ClipRRect), findsNWidgets(2));
expect(find.byType(StreamFileAttachment), findsNWidgets(2));
},
);
@@ -1,11 +1,32 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
import 'package:stream_chat_flutter/scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:stream_chat_flutter/src/message_list_view/floating_date_divider.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import '../mocks.dart';
void main() {
testWidgets('FloatingDateDivider', (tester) async {
final client = MockClient();
final clientState = MockClientState();
when(() => client.state).thenReturn(clientState);
when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id'));
final createdAt = DateTime.now();
final itemPositionsListener = ValueNotifier(
[
const ItemPosition(
index: 0,
itemLeadingEdge: 0,
itemTrailingEdge: 0,
),
],
);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
@@ -14,12 +35,9 @@ void main() {
FloatingDateDivider(
reverse: false,
itemCount: 3,
itemPositionListener: ItemPositionsListener.create(),
messages: [
Message(),
Message(),
Message(),
],
itemPositionListener: itemPositionsListener,
messages: [Message(createdAt: createdAt)],
dateDividerBuilder: (dateTime) => Text('$dateTime'),
),
],
),
@@ -27,6 +45,6 @@ void main() {
),
);
expect(find.byType(Positioned), findsOneWidget);
expect(find.text('$createdAt'), findsOneWidget);
});
}
@@ -1,5 +1,3 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
@@ -70,7 +70,7 @@ final _channelThemeControlMidLerp = StreamChannelHeaderThemeData(
width: 40,
),
),
color: const Color(0xff101418),
color: const Color(0xff111417),
titleStyle: const TextStyle(
color: Color(0xffffffff),
fontWeight: FontWeight.bold,
@@ -73,7 +73,7 @@ final _channelListHeaderThemeControlMidLerp = StreamChannelListHeaderThemeData(
width: 40,
),
),
color: const Color(0xff87898b),
color: const Color(0xff88898a),
titleStyle: const TextStyle(
color: Color(0xff7f7f7f),
fontSize: 16,
@@ -73,11 +73,7 @@ void main() {
home: Builder(
builder: (context) {
_context = context;
return Scaffold(
appBar: StreamGalleryFooter(
mediaAttachmentPackages: Message().getAttachmentPackageList(),
),
);
return const SizedBox.shrink();
},
),
),
@@ -116,11 +112,7 @@ void main() {
home: Builder(
builder: (context) {
_context = context;
return Scaffold(
appBar: StreamGalleryFooter(
mediaAttachmentPackages: Message().getAttachmentPackageList(),
),
);
return const SizedBox.shrink();
},
),
),
@@ -160,7 +152,7 @@ final _galleryFooterThemeDataControl = StreamGalleryFooterThemeData(
// Mid-lerp theme control
const _galleryFooterThemeDataControlMidLerp = StreamGalleryFooterThemeData(
backgroundColor: Color(0xff87898b),
backgroundColor: Color(0xff88898a),
shareIconColor: Color(0xff7f7f7f),
titleTextStyle: TextStyle(
color: Color(0xff7f7f7f),
@@ -169,7 +161,7 @@ const _galleryFooterThemeDataControlMidLerp = StreamGalleryFooterThemeData(
),
gridIconButtonColor: Color(0xff7f7f7f),
bottomSheetBarrierColor: Color(0x4c000000),
bottomSheetBackgroundColor: Color(0xff87898b),
bottomSheetBackgroundColor: Color(0xff88898a),
bottomSheetPhotosTextStyle: TextStyle(
color: Color(0xff7f7f7f),
fontSize: 16,
@@ -66,22 +66,7 @@ void main() {
home: Builder(
builder: (context) {
_context = context;
final attachment = Attachment(
type: 'video',
title: 'video.mp4',
);
final _message = Message(
createdAt: DateTime.now(),
attachments: [
attachment,
],
);
return Scaffold(
appBar: StreamGalleryHeader(
message: _message,
attachment: _message.attachments[0],
),
);
return const SizedBox.shrink();
},
),
),
@@ -116,22 +101,7 @@ void main() {
home: Builder(
builder: (context) {
_context = context;
final attachment = Attachment(
type: 'video',
title: 'video.mp4',
);
final _message = Message(
createdAt: DateTime.now(),
attachments: [
attachment,
],
);
return Scaffold(
appBar: StreamGalleryHeader(
message: _message,
attachment: _message.attachments[0],
),
);
return const SizedBox.shrink();
},
),
),
@@ -175,7 +145,7 @@ final _galleryHeaderThemeDataControl = StreamGalleryHeaderThemeData(
// Light theme test control.
final _galleryHeaderThemeDataHalfLerpControl = StreamGalleryHeaderThemeData(
closeButtonColor: const Color(0xff7f7f7f),
backgroundColor: const Color(0xff87898b),
backgroundColor: const Color(0xff88898a),
iconMenuPointColor: const Color(0xff7f7f7f),
titleTextStyle: const TextStyle(
fontSize: 16,
@@ -194,7 +164,7 @@ final _galleryHeaderThemeDataHalfLerpControl = StreamGalleryHeaderThemeData(
// Dark theme test control.
final _galleryHeaderThemeDataDarkControl = StreamGalleryHeaderThemeData(
closeButtonColor: const Color(0xffffffff),
backgroundColor: const Color(0xff101418),
backgroundColor: const Color(0xff121416),
iconMenuPointColor: const Color(0xffffffff),
titleTextStyle: const TextStyle(
fontSize: 16,
@@ -68,7 +68,7 @@ final _messageInputThemeControl = StreamMessageInputThemeData(
final _messageInputThemeControlMidLerp = StreamMessageInputThemeData(
borderRadius: BorderRadius.circular(20),
sendAnimationDuration: const Duration(milliseconds: 300),
inputBackgroundColor: const Color(0xff87898b),
inputBackgroundColor: const Color(0xff88898a),
actionButtonColor: const Color(0xff196eff),
actionButtonIdleColor: const Color(0xff7a7a7a),
sendButtonColor: const Color(0xff196eff),
@@ -68,12 +68,7 @@ void main() {
home: Builder(
builder: (BuildContext context) {
_context = context;
return Scaffold(
body: StreamChannel(
channel: MockChannel(),
child: const StreamMessageListView(),
),
);
return const SizedBox.shrink();
},
),
),
@@ -98,12 +93,7 @@ void main() {
home: Builder(
builder: (BuildContext context) {
_context = context;
return Scaffold(
body: StreamChannel(
channel: MockChannel(),
child: const StreamMessageListView(),
),
);
return const SizedBox.shrink();
},
),
),
@@ -151,7 +141,7 @@ final _messageListViewThemeDataControl = StreamMessageListViewThemeData(
);
const _messageListViewThemeDataControlHalfLerp = StreamMessageListViewThemeData(
backgroundColor: Color(0xff87898b),
backgroundColor: Color(0xff88898a),
);
final _messageListViewThemeDataControlDark = StreamMessageListViewThemeData(