hide chat info modal on delete

This commit is contained in:
Salvatore Giordano
2021-01-19 09:58:02 +01:00
parent 024ed66154
commit feac47d4e0
@@ -14,6 +14,8 @@ class ChannelBottomSheet extends StatefulWidget {
}
class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
bool _showActions = true;
@override
Widget build(BuildContext context) {
var channel = StreamChannel.of(context).channel;
@@ -33,7 +35,9 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
topRight: Radius.circular(16.0),
),
),
child: ListView(
child: !_showActions
? SizedBox()
: ListView(
shrinkWrap: true,
children: [
SizedBox(
@@ -43,7 +47,8 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: ChannelName(
textStyle: StreamChatTheme.of(context).textTheme.headlineBold,
textStyle:
StreamChatTheme.of(context).textTheme.headlineBold,
),
),
),
@@ -54,8 +59,9 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
child: ChannelInfo(
showTypingIndicator: false,
channel: StreamChannel.of(context).channel,
textStyle:
StreamChatTheme.of(context).channelPreviewTheme.subtitle,
textStyle: StreamChatTheme.of(context)
.channelPreviewTheme
.subtitle,
),
),
SizedBox(
@@ -66,7 +72,8 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
children: [
UserAvatar(
user: members
.firstWhere((e) => e.user.id != userAsMember.user.id)
.firstWhere(
(e) => e.user.id != userAsMember.user.id)
.user,
constraints: BoxConstraints(
maxHeight: 64.0,
@@ -81,10 +88,12 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
),
Text(
members
.firstWhere((e) => e.user.id != userAsMember.user.id)
.firstWhere(
(e) => e.user.id != userAsMember.user.id)
.user
.name,
style: StreamChatTheme.of(context).textTheme.footnoteBold,
style:
StreamChatTheme.of(context).textTheme.footnoteBold,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -153,7 +162,13 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
),
title: 'Leave Group',
onTap: () async {
_showLeaveDialog();
setState(() {
_showActions = false;
});
await _showLeaveDialog();
setState(() {
_showActions = true;
});
},
),
if (isOwner)
@@ -165,9 +180,16 @@ class _ChannelBottomSheetState extends State<ChannelBottomSheet> {
),
),
title: 'Delete Conversation',
titleColor: StreamChatTheme.of(context).colorTheme.accentRed,
titleColor:
StreamChatTheme.of(context).colorTheme.accentRed,
onTap: () async {
_showDeleteDialog();
setState(() {
_showActions = false;
});
await _showDeleteDialog();
setState(() {
_showActions = true;
});
},
),
OptionListTile(