feat(sample-app): Migrate sample app to v4

Signed-off-by: xsahil03x <xdsahil@gmail.com>
This commit is contained in:
Sahil Kumar
2022-03-21 16:12:28 +05:30
committed by xsahil03x
parent 931506c002
commit 420028da2e
21 changed files with 200 additions and 128 deletions
@@ -1,9 +1,6 @@
import 'package:collection/collection.dart' show IterableExtension; import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:jiffy/jiffy.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
/*Navigator.push( /*Navigator.push(
context, context,
-1
View File
@@ -1,5 +1,4 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:imessage/message_list_view.dart'; import 'package:imessage/message_list_view.dart';
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart' import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
show show
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion 30 compileSdkVersion 31
ndkVersion '21.4.7075529' ndkVersion '21.4.7075529'
sourceSets { sourceSets {
@@ -3,7 +3,6 @@ import 'package:example/localizations.dart';
import 'package:example/routes/routes.dart'; import 'package:example/routes/routes.dart';
import 'package:example/stream_version.dart'; import 'package:example/stream_version.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
@@ -160,7 +160,7 @@ class _ChannelFileDisplayScreenState extends State<ChannelFileDisplayScreen> {
padding: const EdgeInsets.all(1.0), padding: const EdgeInsets.all(1.0),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: FileAttachment( child: StreamFileAttachment(
message: media.values.toList()[position], message: media.values.toList()[position],
attachment: media.keys.toList()[position], attachment: media.keys.toList()[position],
), ),
+144 -51
View File
@@ -6,6 +6,7 @@ import 'package:example/search_text_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'channel_page.dart'; import 'channel_page.dart';
import 'chat_info_screen.dart'; import 'chat_info_screen.dart';
@@ -39,6 +40,16 @@ class _ChannelList extends State<ChannelList> {
}); });
} }
late final _channelListController = StreamChannelListController(
client: StreamChat.of(context).client,
filter: Filter.in_(
'members',
[StreamChat.of(context).currentUser!.id],
),
presence: true,
limit: 30,
);
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -86,7 +97,7 @@ class _ChannelList extends State<ChannelList> {
), ),
], ],
body: _isSearchActive body: _isSearchActive
? MessageSearchListView( ? StreamMessageSearchListView(
showErrorTile: true, showErrorTile: true,
messageQuery: _channelQuery, messageQuery: _channelQuery,
filters: Filter.in_('members', [user!.id]), filters: Filter.in_('members', [user!.id]),
@@ -149,59 +160,141 @@ class _ChannelList extends State<ChannelList> {
); );
}, },
) )
: ChannelListView( : SlidableAutoCloseBehavior(
onChannelTap: (channel, _) { closeWhenOpened: true,
Navigator.pushNamed( child: RefreshIndicator(
context, onRefresh: _channelListController.refresh,
Routes.CHANNEL_PAGE, child: StreamChannelListView(
arguments: ChannelPageArgs( controller: _channelListController,
channel: channel, itemBuilder: (context, channel, tile) {
), final chatTheme = StreamChatTheme.of(context);
); final backgroundColor = chatTheme.colorTheme.inputBg;
}, final canDeleteChannel = channel.ownCapabilities
onStartChatPressed: () { .contains(PermissionType.deleteChannel);
Navigator.pushNamed(context, Routes.NEW_CHAT); return Slidable(
}, groupTag: 'channels-actions',
swipeToAction: true, endActionPane: ActionPane(
filter: Filter.in_('members', [user!.id]), extentRatio: canDeleteChannel ? 0.40 : 0.20,
presence: true, motion: const BehindMotion(),
limit: 30, children: [
onViewInfoTap: (channel) { CustomSlidableAction(
Navigator.pop(context); child: Icon(Icons.more_horiz),
if (channel.memberCount == 2 && channel.isDistinct) { backgroundColor: backgroundColor,
Navigator.push( onPressed: (_) {
context, showChannelInfoModalBottomSheet(
MaterialPageRoute( context: context,
builder: (context) => StreamChannel( channel: channel,
onViewInfoTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
final isOneToOne =
channel.memberCount == 2 &&
channel.isDistinct;
return StreamChannel(
channel: channel,
child: isOneToOne
? ChatInfoScreen(
messageTheme: chatTheme
.ownMessageTheme,
user: channel
.state!.members
.where((m) =>
m.userId !=
channel
.client
.state
.currentUser!
.id)
.first
.user,
)
: GroupInfoScreen(
messageTheme: chatTheme
.ownMessageTheme,
),
);
},
),
);
},
);
},
),
if (canDeleteChannel)
CustomSlidableAction(
backgroundColor: backgroundColor,
child: StreamSvgIcon.delete(
color: chatTheme.colorTheme.accentError,
),
onPressed: (_) async {
final res = await showConfirmationDialog(
context,
title: 'Delete Conversation',
question:
'Are you sure you want to delete this conversation?',
okText: 'Delete',
cancelText: 'Cancel',
icon: StreamSvgIcon.delete(
color: chatTheme.colorTheme.accentError,
),
);
if (res == true) {
await _channelListController
.deleteChannel(channel);
}
},
),
],
),
child: tile,
);
},
onChannelTap: (channel) {
Navigator.pushNamed(
context,
Routes.CHANNEL_PAGE,
arguments: ChannelPageArgs(
channel: channel, channel: channel,
child: ChatInfoScreen( ),
messageTheme: );
StreamChatTheme.of(context).ownMessageTheme, },
user: channel.state!.members emptyBuilder: (_) {
.where((m) => return Center(
m.userId != child: Padding(
channel.client.state.currentUser!.id) padding: EdgeInsets.all(8),
.first child: Column(
.user, mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: StreamChannelListEmptyWidget()),
TextButton(
onPressed: () {
Navigator.pushNamed(
context,
Routes.NEW_CHAT,
);
},
child: Text(
'Start a chat',
style: StreamChatTheme.of(context)
.textTheme
.bodyBold
.copyWith(
color: StreamChatTheme.of(context)
.colorTheme
.accentPrimary,
),
),
),
],
), ),
), ),
), );
); },
} else { ),
Navigator.push( ),
context,
MaterialPageRoute(
builder: (context) => StreamChannel(
channel: channel,
child: GroupInfoScreen(
messageTheme:
StreamChatTheme.of(context).ownMessageTheme,
),
),
),
);
}
},
), ),
), ),
), ),
@@ -40,7 +40,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
Positioned( Positioned(
top: -3, top: -3,
right: -16, right: -16,
child: UnreadIndicator(), child: StreamUnreadIndicator(),
), ),
], ],
), ),
@@ -70,7 +70,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
} }
return Scaffold( return Scaffold(
backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, backgroundColor: StreamChatTheme.of(context).colorTheme.appBg,
appBar: ChannelListHeader( appBar: StreamChannelListHeader(
onNewChatButtonTap: () { onNewChatButtonTap: () {
Navigator.pushNamed(context, Routes.NEW_CHAT); Navigator.pushNamed(context, Routes.NEW_CHAT);
}, },
@@ -100,10 +100,8 @@ class _ChannelListPageState extends State<ChannelListPage> {
body: IndexedStack( body: IndexedStack(
index: _currentIndex, index: _currentIndex,
children: [ children: [
ChannelsBloc( MessageSearchBloc(
child: MessageSearchBloc( child: ChannelList(),
child: ChannelList(),
),
), ),
UserMentionsPage(), UserMentionsPage(),
], ],
@@ -165,7 +163,7 @@ class LeftDrawer extends StatelessWidget {
), ),
child: Row( child: Row(
children: [ children: [
UserAvatar( StreamUserAvatar(
user: user, user: user,
showOnlineStatus: false, showOnlineStatus: false,
constraints: BoxConstraints.tight(Size.fromRadius(20)), constraints: BoxConstraints.tight(Size.fromRadius(20)),
@@ -21,7 +21,7 @@ class ChannelMediaDisplayScreen extends StatefulWidget {
final ShowMessageCallback? onShowMessage; final ShowMessageCallback? onShowMessage;
final MessageThemeData messageTheme; final StreamMessageThemeData messageTheme;
const ChannelMediaDisplayScreen({ const ChannelMediaDisplayScreen({
required this.messageTheme, required this.messageTheme,
@@ -180,7 +180,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => StreamChannel( builder: (context) => StreamChannel(
channel: channel, channel: channel,
child: FullScreenMedia( child: StreamFullScreenMedia(
mediaAttachments: mediaAttachments:
media.map((e) => e.attachment).toList(), media.map((e) => e.attachment).toList(),
startIndex: position, startIndex: position,
@@ -194,7 +194,7 @@ class _ChannelMediaDisplayScreenState extends State<ChannelMediaDisplayScreen> {
}, },
child: media[position].attachment.type == 'image' child: media[position].attachment.type == 'image'
? IgnorePointer( ? IgnorePointer(
child: ImageAttachment( child: StreamImageAttachment(
attachment: media[position].attachment, attachment: media[position].attachment,
message: media[position].message, message: media[position].message,
showTitle: false, showTitle: false,
@@ -60,7 +60,7 @@ class _ChannelPageState extends State<ChannelPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, backgroundColor: StreamChatTheme.of(context).colorTheme.appBg,
appBar: ChannelHeader( appBar: StreamChannelHeader(
showTypingIndicator: false, showTypingIndicator: false,
onImageTap: () async { onImageTap: () async {
var channel = StreamChannel.of(context).channel; var channel = StreamChannel.of(context).channel;
@@ -108,7 +108,7 @@ class _ChannelPageState extends State<ChannelPage> {
Expanded( Expanded(
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
MessageListView( StreamMessageListView(
initialScrollIndex: widget.initialScrollIndex, initialScrollIndex: widget.initialScrollIndex,
initialAlignment: widget.initialAlignment, initialAlignment: widget.initialAlignment,
highlightInitialMessage: widget.highlightInitialMessage, highlightInitialMessage: widget.highlightInitialMessage,
@@ -137,7 +137,7 @@ class _ChannelPageState extends State<ChannelPage> {
); );
}, },
deletedBottomRowBuilder: (context, message) { deletedBottomRowBuilder: (context, message) {
return const VisibleFootnote(); return const StreamVisibleFootnote();
}, },
); );
}, },
@@ -155,8 +155,7 @@ class _ChannelPageState extends State<ChannelPage> {
.colorTheme .colorTheme
.appBg .appBg
.withOpacity(.9), .withOpacity(.9),
child: TypingIndicator( child: StreamTypingIndicator(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 8, horizontal: 8,
vertical: 4, vertical: 4,
@@ -174,7 +173,7 @@ class _ChannelPageState extends State<ChannelPage> {
], ],
), ),
), ),
MessageInput( StreamMessageInput(
focusNode: _focusNode, focusNode: _focusNode,
messageInputController: _messageInputController, messageInputController: _messageInputController,
), ),
@@ -1,8 +1,6 @@
import 'package:collection/collection.dart' show IterableExtension;
import 'package:example/localizations.dart'; import 'package:example/localizations.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'channel_file_display_screen.dart'; import 'channel_file_display_screen.dart';
@@ -16,7 +14,7 @@ class ChatInfoScreen extends StatefulWidget {
/// User in consideration /// User in consideration
final User? user; final User? user;
final MessageThemeData messageTheme; final StreamMessageThemeData messageTheme;
const ChatInfoScreen({ const ChatInfoScreen({
Key? key, Key? key,
@@ -54,13 +52,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
height: 8.0, height: 8.0,
color: StreamChatTheme.of(context).colorTheme.disabled, color: StreamChatTheme.of(context).colorTheme.disabled,
), ),
if ([ if (channel.ownCapabilities.contains(PermissionType.deleteChannel))
'admin',
'owner',
].contains(channel.state!.members
.firstWhereOrNull(
(m) => m.userId == channel.client.state.currentUser!.id)
?.role))
_buildDeleteListTile(), _buildDeleteListTile(),
], ],
), ),
@@ -78,7 +70,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: UserAvatar( child: StreamUserAvatar(
user: widget.user!, user: widget.user!,
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
width: 72.0, width: 72.0,
@@ -95,7 +87,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
SizedBox(height: 7.0), SizedBox(height: 7.0),
_buildConnectedTitleState(), _buildConnectedTitleState(),
SizedBox(height: 15.0), SizedBox(height: 15.0),
OptionListTile( StreamOptionListTile(
title: '@${widget.user!.id}', title: '@${widget.user!.id}',
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
trailing: Padding( trailing: Padding(
@@ -148,7 +140,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
builder: (context, snapshot) { builder: (context, snapshot) {
mutedBool.value = snapshot.data; mutedBool.value = snapshot.data;
return OptionListTile( return StreamOptionListTile(
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
title: AppLocalizations.of(context).muteUser, title: AppLocalizations.of(context).muteUser,
titleTextStyle: StreamChatTheme.of(context).textTheme.body, titleTextStyle: StreamChatTheme.of(context).textTheme.body,
@@ -201,7 +193,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
// ), // ),
// onTap: () {}, // onTap: () {},
// ), // ),
OptionListTile( StreamOptionListTile(
title: AppLocalizations.of(context).pinnedMessages, title: AppLocalizations.of(context).pinnedMessages,
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
titleTextStyle: StreamChatTheme.of(context).textTheme.body, titleTextStyle: StreamChatTheme.of(context).textTheme.body,
@@ -261,7 +253,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
); );
}, },
), ),
OptionListTile( StreamOptionListTile(
title: AppLocalizations.of(context).photosAndVideos, title: AppLocalizations.of(context).photosAndVideos,
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
titleTextStyle: StreamChatTheme.of(context).textTheme.body, titleTextStyle: StreamChatTheme.of(context).textTheme.body,
@@ -321,7 +313,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
); );
}, },
), ),
OptionListTile( StreamOptionListTile(
title: AppLocalizations.of(context).files, title: AppLocalizations.of(context).files,
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
titleTextStyle: StreamChatTheme.of(context).textTheme.body, titleTextStyle: StreamChatTheme.of(context).textTheme.body,
@@ -361,7 +353,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
); );
}, },
), ),
OptionListTile( StreamOptionListTile(
title: AppLocalizations.of(context).sharedGroups, title: AppLocalizations.of(context).sharedGroups,
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
titleTextStyle: StreamChatTheme.of(context).textTheme.body, titleTextStyle: StreamChatTheme.of(context).textTheme.body,
@@ -391,7 +383,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
} }
Widget _buildDeleteListTile() { Widget _buildDeleteListTile() {
return OptionListTile( return StreamOptionListTile(
title: 'Delete Conversation', title: 'Delete Conversation',
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
titleTextStyle: StreamChatTheme.of(context).textTheme.body.copyWith( titleTextStyle: StreamChatTheme.of(context).textTheme.body.copyWith(
@@ -632,7 +624,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: ChannelAvatar( child: StreamChannelAvatar(
channel: channel, channel: channel,
constraints: constraints:
BoxConstraints(maxWidth: 40.0, maxHeight: 40.0), BoxConstraints(maxWidth: 40.0, maxHeight: 40.0),
@@ -124,7 +124,7 @@ class ChooseUserPage extends StatelessWidget {
arguments: HomePageArgs(client), arguments: HomePageArgs(client),
); );
}, },
leading: UserAvatar( leading: StreamUserAvatar(
user: user, user: user,
constraints: BoxConstraints.tight( constraints: BoxConstraints.tight(
Size.fromRadius(20), Size.fromRadius(20),
@@ -1,7 +1,6 @@
import 'package:example/localizations.dart'; import 'package:example/localizations.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:uuid/uuid.dart';
import 'channel_page.dart'; import 'channel_page.dart';
import 'routes/routes.dart'; import 'routes/routes.dart';
@@ -155,7 +154,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
), ),
], ],
), ),
body: ConnectionStatusBuilder( body: StreamConnectionStatusBuilder(
statusBuilder: (context, status) { statusBuilder: (context, status) {
String statusString = ''; String statusString = '';
bool showStatus = true; bool showStatus = true;
@@ -172,7 +171,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
statusString = AppLocalizations.of(context).disconnected; statusString = AppLocalizations.of(context).disconnected;
break; break;
} }
return InfoTile( return StreamInfoTile(
showMessage: showStatus, showMessage: showStatus,
tileAnchor: Alignment.topCenter, tileAnchor: Alignment.topCenter,
childAnchor: Alignment.topCenter, childAnchor: Alignment.topCenter,
@@ -222,7 +221,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
final user = _selectedUsers[index]; final user = _selectedUsers[index];
return ListTile( return ListTile(
key: ObjectKey(user), key: ObjectKey(user),
leading: UserAvatar( leading: StreamUserAvatar(
user: user, user: user,
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
width: 40, width: 40,
@@ -4,7 +4,6 @@ import 'package:collection/collection.dart' show IterableExtension;
import 'package:example/localizations.dart'; import 'package:example/localizations.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'channel_file_display_screen.dart'; import 'channel_file_display_screen.dart';
@@ -15,7 +14,7 @@ import 'pinned_messages_screen.dart';
import 'routes/routes.dart'; import 'routes/routes.dart';
class GroupInfoScreen extends StatefulWidget { class GroupInfoScreen extends StatefulWidget {
final MessageThemeData messageTheme; final StreamMessageThemeData messageTheme;
const GroupInfoScreen({ const GroupInfoScreen({
Key? key, Key? key,
@@ -222,7 +221,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
horizontal: 8.0, horizontal: 8.0,
vertical: 12.0, vertical: 12.0,
), ),
child: UserAvatar( child: StreamUserAvatar(
user: member.user!, user: member.user!,
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
height: 40.0, height: 40.0,
@@ -456,7 +455,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
builder: (context, snapshot) { builder: (context, snapshot) {
mutedBool.value = snapshot.data; mutedBool.value = snapshot.data;
return OptionListTile( return StreamOptionListTile(
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
separatorColor: separatorColor:
StreamChatTheme.of(context).colorTheme.disabled, StreamChatTheme.of(context).colorTheme.disabled,
@@ -493,7 +492,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
onTap: () {}, onTap: () {},
); );
}), }),
OptionListTile( StreamOptionListTile(
title: AppLocalizations.of(context).pinnedMessages, title: AppLocalizations.of(context).pinnedMessages,
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
titleTextStyle: StreamChatTheme.of(context).textTheme.body, titleTextStyle: StreamChatTheme.of(context).textTheme.body,
@@ -553,7 +552,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
}, },
), ),
OptionListTile( StreamOptionListTile(
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
separatorColor: StreamChatTheme.of(context).colorTheme.disabled, separatorColor: StreamChatTheme.of(context).colorTheme.disabled,
title: AppLocalizations.of(context).photosAndVideos, title: AppLocalizations.of(context).photosAndVideos,
@@ -615,7 +614,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
}, },
), ),
OptionListTile( StreamOptionListTile(
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
separatorColor: StreamChatTheme.of(context).colorTheme.disabled, separatorColor: StreamChatTheme.of(context).colorTheme.disabled,
title: AppLocalizations.of(context).files, title: AppLocalizations.of(context).files,
@@ -660,7 +659,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
if (!channel.channel.isDistinct && if (!channel.channel.isDistinct &&
channel.channel.ownCapabilities channel.channel.ownCapabilities
.contains(PermissionType.leaveChannel)) .contains(PermissionType.leaveChannel))
OptionListTile( StreamOptionListTile(
tileColor: StreamChatTheme.of(context).colorTheme.appBg, tileColor: StreamChatTheme.of(context).colorTheme.appBg,
separatorColor: StreamChatTheme.of(context).colorTheme.disabled, separatorColor: StreamChatTheme.of(context).colorTheme.disabled,
title: AppLocalizations.of(context).leaveGroup, title: AppLocalizations.of(context).leaveGroup,
@@ -730,7 +729,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
child: _buildTextInputSection(modalSetState), child: _buildTextInputSection(modalSetState),
), ),
Expanded( Expanded(
child: UserListView( child: StreamUserListView(
selectedUsers: {}, selectedUsers: {},
onUserTap: (user, _) async { onUserTap: (user, _) async {
_searchController!.clear(); _searchController!.clear();
@@ -900,7 +899,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
Center( Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: UserAvatar( child: StreamUserAvatar(
user: user, user: user,
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
height: 64.0, height: 64.0,
@@ -4,7 +4,6 @@ import 'package:example/channel_page.dart';
import 'package:example/notifications_service.dart'; import 'package:example/notifications_service.dart';
import 'package:example/routes/app_routes.dart'; import 'package:example/routes/app_routes.dart';
import 'package:example/routes/routes.dart'; import 'package:example/routes/routes.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart';
-1
View File
@@ -4,7 +4,6 @@ import 'package:example/choose_user_page.dart';
import 'package:example/home_page.dart'; import 'package:example/home_page.dart';
import 'package:example/localizations.dart'; import 'package:example/localizations.dart';
import 'package:example/splash_screen.dart'; import 'package:example/splash_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
@@ -130,7 +130,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
), ),
centerTitle: true, centerTitle: true,
), ),
body: ConnectionStatusBuilder( body: StreamConnectionStatusBuilder(
statusBuilder: (context, status) { statusBuilder: (context, status) {
String statusString = ''; String statusString = '';
bool showStatus = true; bool showStatus = true;
@@ -147,7 +147,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
statusString = AppLocalizations.of(context).disconnected; statusString = AppLocalizations.of(context).disconnected;
break; break;
} }
return InfoTile( return StreamInfoTile(
showMessage: showStatus, showMessage: showStatus,
tileAnchor: Alignment.topCenter, tileAnchor: Alignment.topCenter,
childAnchor: Alignment.topCenter, childAnchor: Alignment.topCenter,
@@ -200,7 +200,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
.overlay, .overlay,
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
child: UserAvatar( child: StreamUserAvatar(
showOnlineStatus: false, showOnlineStatus: false,
user: user, user: user,
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
@@ -288,7 +288,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onPanDown: (_) => FocusScope.of(context).unfocus(), onPanDown: (_) => FocusScope.of(context).unfocus(),
child: UsersBloc( child: UsersBloc(
child: UserListView( child: StreamUserListView(
selectedUsers: _selectedUsers, selectedUsers: _selectedUsers,
groupAlphabetically: groupAlphabetically:
_isSearchActive ? false : true, _isSearchActive ? false : true,
@@ -366,7 +366,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
future: channel!.initialized, future: channel!.initialized,
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.data == true) { if (snapshot.data == true) {
return MessageListView(); return StreamMessageListView();
} }
return Center( return Center(
@@ -384,7 +384,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
}, },
), ),
), ),
MessageInput( StreamMessageInput(
focusNode: _messageInputFocusNode, focusNode: _messageInputFocusNode,
preMessageSending: (message) async { preMessageSending: (message) async {
await channel!.watch(); await channel!.watch();
@@ -88,7 +88,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
) )
], ],
), ),
body: ConnectionStatusBuilder( body: StreamConnectionStatusBuilder(
statusBuilder: (context, status) { statusBuilder: (context, status) {
String statusString = ''; String statusString = '';
bool showStatus = true; bool showStatus = true;
@@ -105,7 +105,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
statusString = AppLocalizations.of(context).disconnected; statusString = AppLocalizations.of(context).disconnected;
break; break;
} }
return InfoTile( return StreamInfoTile(
showMessage: showStatus, showMessage: showStatus,
tileAnchor: Alignment.topCenter, tileAnchor: Alignment.topCenter,
childAnchor: Alignment.topCenter, childAnchor: Alignment.topCenter,
@@ -136,7 +136,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
children: [ children: [
Stack( Stack(
children: [ children: [
UserAvatar( StreamUserAvatar(
onlineIndicatorAlignment: onlineIndicatorAlignment:
Alignment(0.9, 0.9), Alignment(0.9, 0.9),
user: user, user: user,
@@ -229,7 +229,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onPanDown: (_) => FocusScope.of(context).unfocus(), onPanDown: (_) => FocusScope.of(context).unfocus(),
child: UsersBloc( child: UsersBloc(
child: UserListView( child: StreamUserListView(
selectedUsers: _selectedUsers, selectedUsers: _selectedUsers,
pullToRefresh: false, pullToRefresh: false,
groupAlphabetically: _isSearchActive ? false : true, groupAlphabetically: _isSearchActive ? false : true,
@@ -21,7 +21,7 @@ class PinnedMessagesScreen extends StatefulWidget {
final ShowMessageCallback? onShowMessage; final ShowMessageCallback? onShowMessage;
final MessageThemeData messageTheme; final StreamMessageThemeData messageTheme;
const PinnedMessagesScreen({ const PinnedMessagesScreen({
required this.messageTheme, required this.messageTheme,
@@ -166,7 +166,7 @@ class _PinnedMessagesScreenState extends State<PinnedMessagesScreen> {
var text = data[position].message.text ?? ''; var text = data[position].message.text ?? '';
return ListTile( return ListTile(
leading: UserAvatar( leading: StreamUserAvatar(
user: user, user: user,
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
width: 40.0, width: 40.0,
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:lottie/lottie.dart'; import 'package:lottie/lottie.dart';
mixin SplashScreenStateMixin<T extends StatefulWidget> on State<T> mixin SplashScreenStateMixin<T extends StatefulWidget> on State<T>
+4 -4
View File
@@ -44,13 +44,13 @@ class _ThreadPageState extends State<ThreadPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, backgroundColor: StreamChatTheme.of(context).colorTheme.appBg,
appBar: ThreadHeader( appBar: StreamThreadHeader(
parent: widget.parent, parent: widget.parent,
), ),
body: Column( body: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: MessageListView( child: StreamMessageListView(
parentMessage: widget.parent, parentMessage: widget.parent,
initialScrollIndex: widget.initialScrollIndex, initialScrollIndex: widget.initialScrollIndex,
initialAlignment: widget.initialAlignment, initialAlignment: widget.initialAlignment,
@@ -62,14 +62,14 @@ class _ThreadPageState extends State<ThreadPage> {
return defaultMessage.copyWith( return defaultMessage.copyWith(
onReplyTap: _reply, onReplyTap: _reply,
deletedBottomRowBuilder: (context, message) { deletedBottomRowBuilder: (context, message) {
return const VisibleFootnote(); return const StreamVisibleFootnote();
}, },
); );
}, },
), ),
), ),
if (widget.parent.type != 'deleted') if (widget.parent.type != 'deleted')
MessageInput( StreamMessageInput(
focusNode: _focusNode, focusNode: _focusNode,
messageInputController: _messageInputController, messageInputController: _messageInputController,
), ),
@@ -10,7 +10,7 @@ class UserMentionsPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final user = StreamChat.of(context).currentUser!; final user = StreamChat.of(context).currentUser!;
return MessageSearchBloc( return MessageSearchBloc(
child: MessageSearchListView( child: StreamMessageSearchListView(
filters: Filter.in_('members', [user.id]), filters: Filter.in_('members', [user.id]),
messageFilters: Filter.custom( messageFilters: Filter.custom(
operator: r'$contains', operator: r'$contains',