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