feat: more implementation.
Signed-off-by: xsahil03x <[email protected]>
@@ -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(
|
||||
@@ -31,26 +53,17 @@ void main() {
|
||||
300,
|
||||
)),
|
||||
message: Message(),
|
||||
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',
|
||||
},
|
||||
),
|
||||
],
|
||||
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(),
|
||||
file: Attachment(
|
||||
giphy: Attachment(
|
||||
type: 'giphy',
|
||||
title: 'example.gif',
|
||||
imageUrl:
|
||||
|
||||
@@ -31,7 +31,7 @@ void main() {
|
||||
300,
|
||||
)),
|
||||
message: Message(),
|
||||
file: 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',
|
||||
|
||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
@@ -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(
|
||||
|
||||