fixed deprecation issues
This commit is contained in:
@@ -50,7 +50,7 @@ class _ChannelList extends State<ChannelList> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final user = StreamChat.of(context).user;
|
final user = StreamChat.of(context).currentUser;
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
if (_isSearchActive) {
|
if (_isSearchActive) {
|
||||||
@@ -167,7 +167,7 @@ class _ChannelList extends State<ChannelList> {
|
|||||||
user: channel.state!.members
|
user: channel.state!.members
|
||||||
.where((m) =>
|
.where((m) =>
|
||||||
m.userId !=
|
m.userId !=
|
||||||
channel.client.state.user!.id)
|
channel.client.state.currentUser!.id)
|
||||||
.first
|
.first
|
||||||
.user,
|
.user,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final user = StreamChat.of(context).user;
|
final user = StreamChat.of(context).currentUser;
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return Offstage();
|
return Offstage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class _ChannelPageState extends State<ChannelPage> {
|
|||||||
var channel = StreamChannel.of(context).channel;
|
var channel = StreamChannel.of(context).channel;
|
||||||
|
|
||||||
if (channel.memberCount == 2 && channel.isDistinct) {
|
if (channel.memberCount == 2 && channel.isDistinct) {
|
||||||
final currentUser = StreamChat.of(context).user;
|
final currentUser = StreamChat.of(context).currentUser;
|
||||||
final otherUser = channel.state!.members.firstWhereOrNull(
|
final otherUser = channel.state!.members.firstWhereOrNull(
|
||||||
(element) => element.user!.id != currentUser!.id,
|
(element) => element.user!.id != currentUser!.id,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
|
|||||||
'owner',
|
'owner',
|
||||||
].contains(channel.state!.members
|
].contains(channel.state!.members
|
||||||
.firstWhereOrNull(
|
.firstWhereOrNull(
|
||||||
(m) => m.userId == channel.client.state.user!.id)
|
(m) => m.userId == channel.client.state.currentUser!.id)
|
||||||
?.role))
|
?.role))
|
||||||
_buildDeleteListTile(),
|
_buildDeleteListTile(),
|
||||||
],
|
],
|
||||||
@@ -385,7 +385,7 @@ class _ChatInfoScreenState extends State<ChatInfoScreen> {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => _SharedGroupsScreen(
|
builder: (context) => _SharedGroupsScreen(
|
||||||
StreamChat.of(context).user, widget.user)));
|
StreamChat.of(context).currentUser, widget.user)));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -603,7 +603,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
|
|||||||
String? title;
|
String? title;
|
||||||
if (extraData['name'] == null) {
|
if (extraData['name'] == null) {
|
||||||
final otherMembers = members.where(
|
final otherMembers = members.where(
|
||||||
(member) => member.userId != StreamChat.of(context).user!.id);
|
(member) => member.userId != StreamChat.of(context).currentUser!.id);
|
||||||
if (otherMembers.isNotEmpty) {
|
if (otherMembers.isNotEmpty) {
|
||||||
final maxWidth = constraints.maxWidth;
|
final maxWidth = constraints.maxWidth;
|
||||||
final maxChars = maxWidth / textStyle.fontSize!;
|
final maxChars = maxWidth / textStyle.fontSize!;
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
|
|||||||
id: Uuid().v4(),
|
id: Uuid().v4(),
|
||||||
extraData: {
|
extraData: {
|
||||||
'members': [
|
'members': [
|
||||||
client.state.user!.id,
|
client.state.currentUser!.id,
|
||||||
..._selectedUsers.map((e) => e.id),
|
..._selectedUsers.map((e) => e.id),
|
||||||
],
|
],
|
||||||
'name': groupName,
|
'name': groupName,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var userMember = snapshot.data!.firstWhereOrNull(
|
var userMember = snapshot.data!.firstWhereOrNull(
|
||||||
(e) => e.user!.id == StreamChat.of(context).user!.id,
|
(e) => e.user!.id == StreamChat.of(context).currentUser!.id,
|
||||||
);
|
);
|
||||||
var isOwner = userMember?.role == 'owner';
|
var isOwner = userMember?.role == 'owner';
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final userMember = groupMembers.firstWhereOrNull(
|
final userMember = groupMembers.firstWhereOrNull(
|
||||||
(e) => e.user!.id == StreamChat.of(context).user!.id,
|
(e) => e.user!.id == StreamChat.of(context).currentUser!.id,
|
||||||
);
|
);
|
||||||
_showUserInfoModal(member.user, userMember?.role == 'owner');
|
_showUserInfoModal(member.user, userMember?.role == 'owner');
|
||||||
},
|
},
|
||||||
@@ -686,7 +686,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
);
|
);
|
||||||
if (res == true) {
|
if (res == true) {
|
||||||
final channel = StreamChannel.of(context).channel;
|
final channel = StreamChannel.of(context).channel;
|
||||||
await channel.removeMembers([StreamChat.of(context).user!.id]);
|
await channel.removeMembers([StreamChat.of(context).currentUser!.id]);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -740,7 +740,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
if (_searchController!.text.isNotEmpty)
|
if (_searchController!.text.isNotEmpty)
|
||||||
Filter.autoComplete('name', _userNameQuery),
|
Filter.autoComplete('name', _userNameQuery),
|
||||||
Filter.notIn('id', [
|
Filter.notIn('id', [
|
||||||
StreamChat.of(context).user!.id,
|
StreamChat.of(context).currentUser!.id,
|
||||||
...channel.state!.members
|
...channel.state!.members
|
||||||
.map<String?>(((e) => e.userId))
|
.map<String?>(((e) => e.userId))
|
||||||
.whereType<String>(),
|
.whereType<String>(),
|
||||||
@@ -904,7 +904,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (StreamChat.of(context).user!.id != user.id)
|
if (StreamChat.of(context).currentUser!.id != user.id)
|
||||||
_buildModalListTile(
|
_buildModalListTile(
|
||||||
context,
|
context,
|
||||||
StreamSvgIcon.user(
|
StreamSvgIcon.user(
|
||||||
@@ -920,7 +920,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
var c = client.channel('messaging', extraData: {
|
var c = client.channel('messaging', extraData: {
|
||||||
'members': [
|
'members': [
|
||||||
user.id,
|
user.id,
|
||||||
StreamChat.of(context).user!.id,
|
StreamChat.of(context).currentUser!.id,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -940,7 +940,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (StreamChat.of(context).user!.id != user.id)
|
if (StreamChat.of(context).currentUser!.id != user.id)
|
||||||
_buildModalListTile(
|
_buildModalListTile(
|
||||||
context,
|
context,
|
||||||
StreamSvgIcon.message(
|
StreamSvgIcon.message(
|
||||||
@@ -956,7 +956,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
var c = client.channel('messaging', extraData: {
|
var c = client.channel('messaging', extraData: {
|
||||||
'members': [
|
'members': [
|
||||||
user.id,
|
user.id,
|
||||||
StreamChat.of(context).user!.id,
|
StreamChat.of(context).currentUser!.id,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -986,7 +986,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
// // TODO: Add make owner implementation (Remaining from backend)
|
// // TODO: Add make owner implementation (Remaining from backend)
|
||||||
// }),
|
// }),
|
||||||
if (!channel.isDistinct &&
|
if (!channel.isDistinct &&
|
||||||
StreamChat.of(context).user!.id != user.id &&
|
StreamChat.of(context).currentUser!.id != user.id &&
|
||||||
isUserAdmin)
|
isUserAdmin)
|
||||||
_buildModalListTile(
|
_buildModalListTile(
|
||||||
context,
|
context,
|
||||||
@@ -1117,7 +1117,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
var client = StreamChat.of(context);
|
var client = StreamChat.of(context);
|
||||||
if (extraData['name'] == null) {
|
if (extraData['name'] == null) {
|
||||||
final otherMembers =
|
final otherMembers =
|
||||||
members!.where((member) => member.user!.id != client.user!.id);
|
members!.where((member) => member.user!.id != client.currentUser!.id);
|
||||||
if (otherMembers.isNotEmpty) {
|
if (otherMembers.isNotEmpty) {
|
||||||
final maxWidth = width;
|
final maxWidth = width;
|
||||||
final maxChars = maxWidth / maxFontSize!;
|
final maxChars = maxWidth / maxFontSize!;
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class _MyAppState extends State<MyApp>
|
|||||||
)!
|
)!
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
initialRoute: _initData!.client.state.user == null
|
initialRoute: _initData!.client.state.currentUser == null
|
||||||
? Routes.CHOOSE_USER
|
? Routes.CHOOSE_USER
|
||||||
: Routes.HOME,
|
: Routes.HOME,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
|||||||
filter: Filter.raw(value: {
|
filter: Filter.raw(value: {
|
||||||
'members': [
|
'members': [
|
||||||
..._selectedUsers.map((e) => e.id),
|
..._selectedUsers.map((e) => e.id),
|
||||||
chatState.user!.id,
|
chatState.currentUser!.id,
|
||||||
],
|
],
|
||||||
'distinct': true,
|
'distinct': true,
|
||||||
}),
|
}),
|
||||||
@@ -91,7 +91,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
|||||||
extraData: {
|
extraData: {
|
||||||
'members': [
|
'members': [
|
||||||
..._selectedUsers.map((e) => e.id),
|
..._selectedUsers.map((e) => e.id),
|
||||||
chatState.user!.id,
|
chatState.currentUser!.id,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -308,7 +308,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
|
|||||||
if (_userNameQuery.isNotEmpty)
|
if (_userNameQuery.isNotEmpty)
|
||||||
Filter.autoComplete('name', _userNameQuery),
|
Filter.autoComplete('name', _userNameQuery),
|
||||||
Filter.notEqual(
|
Filter.notEqual(
|
||||||
'id', StreamChat.of(context).user!.id),
|
'id', StreamChat.of(context).currentUser!.id),
|
||||||
]),
|
]),
|
||||||
sort: [
|
sort: [
|
||||||
SortOption(
|
SortOption(
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
|||||||
filter: Filter.and([
|
filter: Filter.and([
|
||||||
if (_userNameQuery.isNotEmpty)
|
if (_userNameQuery.isNotEmpty)
|
||||||
Filter.autoComplete('name', _userNameQuery),
|
Filter.autoComplete('name', _userNameQuery),
|
||||||
Filter.notEqual('id', StreamChat.of(context).user!.id),
|
Filter.notEqual('id', StreamChat.of(context).currentUser!.id),
|
||||||
]),
|
]),
|
||||||
sort: [
|
sort: [
|
||||||
SortOption(
|
SortOption(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import 'channel_page.dart';
|
|||||||
class UserMentionsPage extends StatelessWidget {
|
class UserMentionsPage extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final user = StreamChat.of(context).user!;
|
final user = StreamChat.of(context).currentUser!;
|
||||||
return MessageSearchBloc(
|
return MessageSearchBloc(
|
||||||
child: MessageSearchListView(
|
child: MessageSearchListView(
|
||||||
filters: Filter.in_('members', [user.id]),
|
filters: Filter.in_('members', [user.id]),
|
||||||
|
|||||||
Reference in New Issue
Block a user