add modal before removing member and remove make owner (not yet in backend)

This commit is contained in:
Salvatore Giordano
2021-05-20 14:40:35 +02:00
parent 1ec08cef83
commit c9e72ebc91
@@ -670,8 +670,9 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
Filter.autoComplete('name', _userNameQuery), Filter.autoComplete('name', _userNameQuery),
Filter.notIn('id', [ Filter.notIn('id', [
StreamChat.of(context).user!.id, StreamChat.of(context).user!.id,
...channel.state!.members.map(((e) => e.userId!) ...channel.state!.members
as Object Function(Member)), .map<String?>(((e) => e.userId))
.whereType<String>(),
]), ]),
], ],
), ),
@@ -893,18 +894,18 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
}, },
), ),
if (!channel.isDistinct && // if (!channel.isDistinct &&
StreamChat.of(context).user!.id != user.id && // StreamChat.of(context).user!.id != user.id &&
isUserAdmin) // isUserAdmin)
_buildModalListTile( // _buildModalListTile(
context, // context,
StreamSvgIcon.iconUserSettings( // StreamSvgIcon.iconUserSettings(
color: StreamChatTheme.of(context).colorTheme.grey, // color: StreamChatTheme.of(context).colorTheme.grey,
size: 24.0, // size: 24.0,
), // ),
'Make Owner', () { // 'Make Owner', () {
// 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).user!.id != user.id &&
isUserAdmin) isUserAdmin)
@@ -915,7 +916,17 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
size: 24.0, size: 24.0,
), ),
'Remove From Group', () async { 'Remove From Group', () async {
await channel.removeMembers([user.id]); final res = await showConfirmationDialog(
context,
title: 'Remove member',
okText: 'REMOVE',
question: 'Are you sure you want to remove this member?',
cancelText: 'CANCEL',
);
if (res == true) {
await channel.removeMembers([user.id]);
}
Navigator.pop(context); Navigator.pop(context);
}, color: StreamChatTheme.of(context).colorTheme.accentRed), }, color: StreamChatTheme.of(context).colorTheme.accentRed),
_buildModalListTile( _buildModalListTile(