hide overlay on delete message
This commit is contained in:
@@ -61,6 +61,8 @@ class MessageActionsModal extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MessageActionsModalState extends State<MessageActionsModal> {
|
class _MessageActionsModalState extends State<MessageActionsModal> {
|
||||||
|
bool _showActions = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return _showMessageOptionsModal();
|
return _showMessageOptionsModal();
|
||||||
@@ -87,160 +89,163 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
? 1
|
? 1
|
||||||
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / roughMaxSize));
|
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / roughMaxSize));
|
||||||
|
|
||||||
return TweenAnimationBuilder<double>(
|
final hasFileAttachment =
|
||||||
tween: Tween(begin: 0.0, end: 1.0),
|
widget.message.attachments?.any((it) => it.type == 'file') == true;
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
curve: Curves.easeInOutBack,
|
return GestureDetector(
|
||||||
builder: (context, val, snapshot) {
|
behavior: HitTestBehavior.translucent,
|
||||||
final hasFileAttachment =
|
onTap: () => Navigator.maybePop(context),
|
||||||
widget.message.attachments?.any((it) => it.type == 'file') == true;
|
child: Stack(
|
||||||
return GestureDetector(
|
children: [
|
||||||
behavior: HitTestBehavior.translucent,
|
Positioned.fill(
|
||||||
onTap: () => Navigator.maybePop(context),
|
child: BackdropFilter(
|
||||||
child: Stack(
|
filter: ImageFilter.blur(
|
||||||
children: [
|
sigmaX: 10,
|
||||||
Positioned.fill(
|
sigmaY: 10,
|
||||||
child: BackdropFilter(
|
|
||||||
filter: ImageFilter.blur(
|
|
||||||
sigmaX: 10,
|
|
||||||
sigmaY: 10,
|
|
||||||
),
|
|
||||||
child: Container(
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.overlay,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Transform.scale(
|
child: Container(
|
||||||
scale: val,
|
color: StreamChatTheme.of(context).colorTheme.overlay,
|
||||||
child: Center(
|
),
|
||||||
child: SingleChildScrollView(
|
),
|
||||||
child: Padding(
|
),
|
||||||
padding: const EdgeInsets.all(8.0),
|
if (_showActions)
|
||||||
child: Column(
|
TweenAnimationBuilder<double>(
|
||||||
crossAxisAlignment: widget.reverse
|
tween: Tween(begin: 0.0, end: 1.0),
|
||||||
? CrossAxisAlignment.end
|
duration: Duration(milliseconds: 300),
|
||||||
: CrossAxisAlignment.start,
|
curve: Curves.easeInOutBack,
|
||||||
children: <Widget>[
|
builder: (context, val, snapshot) {
|
||||||
if (widget.showReactions &&
|
return Transform.scale(
|
||||||
(widget.message.status ==
|
scale: val,
|
||||||
MessageSendingStatus.SENT ||
|
child: Center(
|
||||||
widget.message.status == null))
|
child: SingleChildScrollView(
|
||||||
Align(
|
child: Padding(
|
||||||
alignment: Alignment(
|
padding: const EdgeInsets.all(8.0),
|
||||||
user.id == widget.message.user.id
|
child: Column(
|
||||||
? (divFactor > 1.0
|
crossAxisAlignment: widget.reverse
|
||||||
? 0.0
|
? CrossAxisAlignment.end
|
||||||
: (1.0 - divFactor))
|
: CrossAxisAlignment.start,
|
||||||
: (divFactor > 1.0
|
children: <Widget>[
|
||||||
? 0.0
|
if (widget.showReactions &&
|
||||||
: -(1.0 - divFactor)),
|
(widget.message.status ==
|
||||||
0.0),
|
MessageSendingStatus.SENT ||
|
||||||
child: ReactionPicker(
|
widget.message.status == null))
|
||||||
message: widget.message,
|
Align(
|
||||||
messageTheme: widget.messageTheme,
|
alignment: Alignment(
|
||||||
),
|
user.id == widget.message.user.id
|
||||||
),
|
? (divFactor > 1.0
|
||||||
SizedBox(height: 8),
|
? 0.0
|
||||||
IgnorePointer(
|
: (1.0 - divFactor))
|
||||||
child: MessageWidget(
|
: (divFactor > 1.0
|
||||||
key: Key('MessageWidget'),
|
? 0.0
|
||||||
reverse: widget.reverse,
|
: -(1.0 - divFactor)),
|
||||||
message: widget.message.copyWith(
|
0.0),
|
||||||
text: widget.message.text.length > 200
|
child: ReactionPicker(
|
||||||
? '${widget.message.text.substring(0, 200)}...'
|
message: widget.message,
|
||||||
: widget.message.text,
|
messageTheme: widget.messageTheme,
|
||||||
),
|
|
||||||
messageTheme: widget.messageTheme,
|
|
||||||
showReactions: false,
|
|
||||||
showUsername: false,
|
|
||||||
showThreadReplyIndicator: false,
|
|
||||||
showReplyMessage: false,
|
|
||||||
showUserAvatar: widget.showUserAvatar,
|
|
||||||
attachmentPadding: EdgeInsets.all(
|
|
||||||
hasFileAttachment ? 4 : 2,
|
|
||||||
),
|
|
||||||
showTimestamp: false,
|
|
||||||
translateUserAvatar: false,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
textPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 8.0,
|
|
||||||
horizontal:
|
|
||||||
widget.message.text.isOnlyEmoji ? 0 : 16.0,
|
|
||||||
),
|
|
||||||
showReactionPickerIndicator:
|
|
||||||
widget.showReactions &&
|
|
||||||
(widget.message.status ==
|
|
||||||
MessageSendingStatus.SENT ||
|
|
||||||
widget.message.status == null),
|
|
||||||
showInChannelIndicator: false,
|
|
||||||
showSendingIndicator: false,
|
|
||||||
shape: widget.messageShape,
|
|
||||||
attachmentShape: widget.attachmentShape,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 8),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
left: widget.reverse ? 0 : 40,
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
width: MediaQuery.of(context).size.width * 0.75,
|
|
||||||
child: Material(
|
|
||||||
color: StreamChatTheme.of(context)
|
|
||||||
.colorTheme
|
|
||||||
.whiteSnow,
|
|
||||||
clipBehavior: Clip.hardEdge,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(16),
|
|
||||||
),
|
),
|
||||||
child: Column(
|
),
|
||||||
crossAxisAlignment:
|
SizedBox(height: 8),
|
||||||
CrossAxisAlignment.stretch,
|
IgnorePointer(
|
||||||
children: [
|
child: MessageWidget(
|
||||||
if (widget.showReplyMessage &&
|
key: Key('MessageWidget'),
|
||||||
|
reverse: widget.reverse,
|
||||||
|
message: widget.message.copyWith(
|
||||||
|
text: widget.message.text.length > 200
|
||||||
|
? '${widget.message.text.substring(0, 200)}...'
|
||||||
|
: widget.message.text,
|
||||||
|
),
|
||||||
|
messageTheme: widget.messageTheme,
|
||||||
|
showReactions: false,
|
||||||
|
showUsername: false,
|
||||||
|
showThreadReplyIndicator: false,
|
||||||
|
showReplyMessage: false,
|
||||||
|
showUserAvatar: widget.showUserAvatar,
|
||||||
|
attachmentPadding: EdgeInsets.all(
|
||||||
|
hasFileAttachment ? 4 : 2,
|
||||||
|
),
|
||||||
|
showTimestamp: false,
|
||||||
|
translateUserAvatar: false,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
textPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 8.0,
|
||||||
|
horizontal: widget.message.text.isOnlyEmoji
|
||||||
|
? 0
|
||||||
|
: 16.0,
|
||||||
|
),
|
||||||
|
showReactionPickerIndicator:
|
||||||
|
widget.showReactions &&
|
||||||
(widget.message.status ==
|
(widget.message.status ==
|
||||||
MessageSendingStatus.SENT ||
|
MessageSendingStatus.SENT ||
|
||||||
widget.message.status == null) &&
|
widget.message.status == null),
|
||||||
widget.message.parentId == null)
|
showInChannelIndicator: false,
|
||||||
_buildReplyButton(context),
|
showSendingIndicator: false,
|
||||||
if (widget.showThreadReplyMessage &&
|
shape: widget.messageShape,
|
||||||
(widget.message.status ==
|
attachmentShape: widget.attachmentShape,
|
||||||
MessageSendingStatus.SENT ||
|
),
|
||||||
widget.message.status == null) &&
|
),
|
||||||
widget.message.parentId == null)
|
SizedBox(height: 8),
|
||||||
_buildThreadReplyButton(context),
|
Padding(
|
||||||
if (widget.showResendMessage)
|
padding: EdgeInsets.only(
|
||||||
_buildResendMessage(context),
|
left: widget.reverse ? 0 : 40,
|
||||||
if (widget.showEditMessage)
|
),
|
||||||
_buildEditMessage(context),
|
child: SizedBox(
|
||||||
if (widget.showCopyMessage)
|
width: MediaQuery.of(context).size.width * 0.75,
|
||||||
_buildCopyButton(context),
|
child: Material(
|
||||||
if (widget.showFlagButton)
|
color: StreamChatTheme.of(context)
|
||||||
_buildFlagButton(context),
|
.colorTheme
|
||||||
if (widget.showDeleteMessage)
|
.whiteSnow,
|
||||||
_buildDeleteButton(context),
|
clipBehavior: Clip.hardEdge,
|
||||||
].insertBetween(
|
shape: RoundedRectangleBorder(
|
||||||
Container(
|
borderRadius: BorderRadius.circular(16),
|
||||||
height: 1,
|
),
|
||||||
color: StreamChatTheme.of(context)
|
child: Column(
|
||||||
.colorTheme
|
crossAxisAlignment:
|
||||||
.greyWhisper,
|
CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
if (widget.showReplyMessage &&
|
||||||
|
(widget.message.status ==
|
||||||
|
MessageSendingStatus.SENT ||
|
||||||
|
widget.message.status == null) &&
|
||||||
|
widget.message.parentId == null)
|
||||||
|
_buildReplyButton(context),
|
||||||
|
if (widget.showThreadReplyMessage &&
|
||||||
|
(widget.message.status ==
|
||||||
|
MessageSendingStatus.SENT ||
|
||||||
|
widget.message.status == null) &&
|
||||||
|
widget.message.parentId == null)
|
||||||
|
_buildThreadReplyButton(context),
|
||||||
|
if (widget.showResendMessage)
|
||||||
|
_buildResendMessage(context),
|
||||||
|
if (widget.showEditMessage)
|
||||||
|
_buildEditMessage(context),
|
||||||
|
if (widget.showCopyMessage)
|
||||||
|
_buildCopyButton(context),
|
||||||
|
if (widget.showFlagButton)
|
||||||
|
_buildFlagButton(context),
|
||||||
|
if (widget.showDeleteMessage)
|
||||||
|
_buildDeleteButton(context),
|
||||||
|
].insertBetween(
|
||||||
|
Container(
|
||||||
|
height: 1,
|
||||||
|
color: StreamChatTheme.of(context)
|
||||||
|
.colorTheme
|
||||||
|
.greyWhisper,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
);
|
),
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +278,9 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _showDeleteDialog() async {
|
void _showDeleteDialog() async {
|
||||||
|
setState(() {
|
||||||
|
_showActions = false;
|
||||||
|
});
|
||||||
var answer = await showConfirmationDialog(context,
|
var answer = await showConfirmationDialog(context,
|
||||||
title: 'Delete message',
|
title: 'Delete message',
|
||||||
icon: StreamSvgIcon.flag(
|
icon: StreamSvgIcon.flag(
|
||||||
@@ -293,6 +301,10 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
_showErrorAlert();
|
_showErrorAlert();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_showActions = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user