Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions docs/docs_screenshots/test/channel/channel_preview_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:alchemist/alchemist.dart';
import 'package:device_preview/device_preview.dart';
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 '../src/golden_client_stubs.dart';
Expand Down Expand Up @@ -200,4 +201,164 @@ void main() {
);
},
);

goldenTest(
'slidable channel list with header',
fileName: 'slidable_channel_list',
constraints: const BoxConstraints.tightFor(width: 430, height: 932),
builder: () {
final client = MockClient();
final clientState = MockClientState();
when(() => client.state).thenReturn(clientState);
when(() => clientState.currentUser).thenReturn(OwnUser(id: 'user-id', name: 'Alice'));

final channels = [
fakeChannel(
client: client,
id: 'general',
name: 'General',
messages: [
Message(
id: 'msg-1',
text: 'Hey, how is everyone doing?',
user: User(id: 'user-2', name: 'Bob'),
createdAt: DateTime(2024, 6, 1, 10, 30),
),
],
unreadCount: 2,
),
fakeChannel(
client: client,
id: 'design',
name: 'Design',
messages: [
Message(
id: 'msg-2',
text: 'New mockups are ready!',
user: User(id: 'user-3', name: 'Carol'),
createdAt: DateTime(2024, 6, 1, 9, 15),
),
],
),
fakeChannel(
client: client,
id: 'random',
name: 'Random',
messages: [
Message(
id: 'msg-3',
text: 'Anyone up for lunch?',
user: User(id: 'user-4', name: 'Dave'),
createdAt: DateTime(2024, 5, 31, 12, 0),
),
],
),
fakeChannel(
client: client,
id: 'engineering',
name: 'Engineering',
messages: [
Message(
id: 'msg-4',
text: 'PR #42 is ready for review',
user: User(id: 'user-5', name: 'Eve'),
createdAt: DateTime(2024, 5, 30, 15, 45),
),
],
),
];

final controller = StreamChannelListController.fromValue(
PagedValue(items: channels),
client: client,
);

stubQueryChannelsForGoldens(client, channels);

return DeviceFrame(
device: Devices.ios.iPhone13,
isFrameVisible: true,
screen: MaterialApp(
theme: docsScreenshotsTheme(),
debugShowCheckedModeBanner: false,
home: StreamChat(
client: client,
streamChatThemeData: docsStreamChatThemeData(),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: Builder(
builder: (context) {
final chatTheme = StreamChatTheme.of(context);
final backgroundColor = chatTheme.colorTheme.inputBg;
return Scaffold(
appBar: const StreamChannelListHeader(),
body: Column(
children: [
// First channel shown swiped to reveal slidable actions
SizedBox(
height: 80,
child: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
width: 80,
height: 80,
child: ColoredBox(
color: backgroundColor,
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.more_horiz),
],
),
),
),
SizedBox(
width: 80,
height: 80,
child: ColoredBox(
color: backgroundColor,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.delete_outline,
color: chatTheme.colorTheme.accentError,
),
],
),
),
),
],
),
Transform.translate(
offset: const Offset(-160, 0),
child: ColoredBox(
color: Colors.white,
child: StreamChannelListItem(channel: channels[0]),
),
),
],
),
),
Expanded(
child: StreamChannelListView(
controller: StreamChannelListController.fromValue(
PagedValue(items: channels.sublist(1)),
client: client,
),
shrinkWrap: true,
),
),
],
),
);
},
),
),
),
);
},
);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:record/record.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:stream_core_flutter/stream_core_flutter.dart' as core;

import '../src/fakes.dart';
import '../src/golden_theme.dart';
Expand Down Expand Up @@ -134,6 +135,62 @@ void main() {
},
);

goldenTest(
'custom send icon via StreamIcons',
fileName: 'message_input_custom_send_icon',
constraints: const BoxConstraints.tightFor(width: 375, height: 100),
builder: () {
final client = MockClient();
final clientState = MockClientState();
final channel = MockChannel();
final channelState = MockChannelState();

setupMockChannel(
client: client,
clientState: clientState,
channel: channel,
channelState: channelState,
);

final streamTextTheme = core.StreamTextTheme().apply(
color: core.StreamColorScheme.light().systemText,
fontFamily: 'Roboto',
);

return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
brightness: Brightness.light,
extensions: [
StreamTheme(
brightness: Brightness.light,
textTheme: streamTextTheme,
icons: const StreamIcons(send: Icons.reply_rounded),
),
],
),
home: StreamChat(
client: client,
streamChatThemeData: docsStreamChatThemeData(),
connectivityStream: Stream.value([ConnectivityResult.mobile]),
child: StreamChannel(
showLoading: false,
channel: channel,
child: Scaffold(
body: Column(
children: [
Expanded(child: Container()),
const StreamMessageInput(),
],
),
),
),
),
);
},
);

goldenTest(
'message input with quoted message',
fileName: 'message_input_quoted_message',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/docs_screenshots/test/polls/goldens/macos/poll_creator.png
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ void main() {
client: client,
controller: controller,
banner: const StreamUnreadThreadsBanner(
enabled: true,
unreadThreads: {'thread-1', 'thread-2', 'thread-3'},
),
);
Expand Down
Loading
Loading