fix: fixed for all chats

This commit is contained in:
Deven Joshi
2020-12-30 21:22:03 +05:30
parent 8a390347a7
commit a766e404c5
2 changed files with 81 additions and 47 deletions
+1 -2
View File
@@ -374,8 +374,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
), ),
channelWidget: ChannelPage(), channelWidget: ChannelPage(),
onChannelLongPress: (channel) { onChannelLongPress: (channel) {
if (!channel.isDistinct) _showChannelDetailsModal(channel);
_showChannelDetailsModal(channel);
}, },
), ),
), ),
+80 -45
View File
@@ -16,6 +16,8 @@ class ChannelActionsModal extends StatefulWidget {
class _ChannelActionsModalState extends State<ChannelActionsModal> { class _ChannelActionsModalState extends State<ChannelActionsModal> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var channel = StreamChannel.of(context).channel;
return Material( return Material(
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@@ -72,42 +74,73 @@ class _ChannelActionsModalState extends State<ChannelActionsModal> {
SizedBox( SizedBox(
height: 17.0, height: 17.0,
), ),
Container( if (channel.isDistinct && channel.memberCount == 2)
height: 94.0, Column(
child: ListView.builder( children: [
scrollDirection: Axis.horizontal, UserAvatar(
itemCount: snapshot.data.members.length, user: snapshot.data.members
itemBuilder: (context, index) { .firstWhere((e) => e.user.id != userAsMember.user.id)
return Padding( .user,
padding: const EdgeInsets.symmetric(horizontal: 8.0), constraints: BoxConstraints(
child: Column( maxHeight: 64.0,
children: [ maxWidth: 64.0,
UserAvatar(
user: snapshot.data.members[index].user,
constraints: BoxConstraints(
maxHeight: 64.0,
maxWidth: 64.0,
),
borderRadius: BorderRadius.circular(32.0),
),
SizedBox(
height: 6.0,
),
Text(
snapshot.data.members[index].user.name,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w600,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
), ),
); borderRadius: BorderRadius.circular(32.0),
}, ),
SizedBox(
height: 6.0,
),
Text(
snapshot.data.members
.firstWhere((e) => e.user.id != userAsMember.user.id)
.user
.name,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w600,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
if (!(channel.isDistinct && channel.memberCount == 2))
Container(
height: 94.0,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: snapshot.data.members.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
children: [
UserAvatar(
user: snapshot.data.members[index].user,
constraints: BoxConstraints(
maxHeight: 64.0,
maxWidth: 64.0,
),
borderRadius: BorderRadius.circular(32.0),
),
SizedBox(
height: 6.0,
),
Text(
snapshot.data.members[index].user.name,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w600,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
);
},
),
), ),
),
SizedBox( SizedBox(
height: 24, height: 24,
), ),
@@ -118,18 +151,20 @@ class _ChannelActionsModalState extends State<ChannelActionsModal> {
title: 'View Info', title: 'View Info',
onTap: widget.onViewInfoTap, onTap: widget.onViewInfoTap,
), ),
OptionListTile( if (!channel.isDistinct)
leading: StreamSvgIcon.userRemove( OptionListTile(
color: Color(0xff7a7a7a), leading: StreamSvgIcon.userRemove(
), color: Color(0xff7a7a7a),
title: 'Leave Group', ),
onTap: () async { title: 'Leave Group',
var channel = StreamChannel.of(context).channel; onTap: () async {
var channel = StreamChannel.of(context).channel;
await channel.removeMembers([StreamChat.of(context).user.id]); await channel
Navigator.pop(context); .removeMembers([StreamChat.of(context).user.id]);
}, Navigator.pop(context);
), },
),
if (isOwner) if (isOwner)
OptionListTile( OptionListTile(
leading: StreamSvgIcon.delete( leading: StreamSvgIcon.delete(