[MessageActionModal] Fix action tile padding and divider
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
+147
-134
@@ -186,36 +186,37 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.stretch,
|
CrossAxisAlignment.stretch,
|
||||||
children: ListTile.divideTiles(
|
children: [
|
||||||
color: StreamChatTheme.of(context)
|
if (widget.showReplyMessage &&
|
||||||
.colorTheme
|
(widget.message.status ==
|
||||||
.greyWhisper,
|
MessageSendingStatus.SENT ||
|
||||||
context: context,
|
widget.message.status == null) &&
|
||||||
tiles: [
|
widget.message.parentId == null)
|
||||||
if (widget.showReplyMessage &&
|
_buildReplyButton(context),
|
||||||
(widget.message.status ==
|
if (widget.showThreadReplyMessage &&
|
||||||
MessageSendingStatus.SENT ||
|
(widget.message.status ==
|
||||||
widget.message.status == null) &&
|
MessageSendingStatus.SENT ||
|
||||||
widget.message.parentId == null)
|
widget.message.status == null) &&
|
||||||
_buildReplyButton(context),
|
widget.message.parentId == null)
|
||||||
if (widget.showThreadReplyMessage &&
|
_buildThreadReplyButton(context),
|
||||||
(widget.message.status ==
|
if (widget.showResendMessage)
|
||||||
MessageSendingStatus.SENT ||
|
_buildResendMessage(context),
|
||||||
widget.message.status == null) &&
|
if (widget.showEditMessage)
|
||||||
widget.message.parentId == null)
|
_buildEditMessage(context),
|
||||||
_buildThreadReplyButton(context),
|
if (widget.showCopyMessage)
|
||||||
if (widget.showResendMessage)
|
_buildCopyButton(context),
|
||||||
_buildResendMessage(context),
|
if (widget.showFlagButton)
|
||||||
if (widget.showEditMessage)
|
_buildFlagButton(context),
|
||||||
_buildEditMessage(context),
|
if (widget.showDeleteMessage)
|
||||||
if (widget.showCopyMessage)
|
_buildDeleteButton(context),
|
||||||
_buildCopyButton(context),
|
].insertBetween(
|
||||||
if (widget.showFlagButton)
|
Container(
|
||||||
_buildFlagButton(context),
|
height: 1,
|
||||||
if (widget.showDeleteMessage)
|
color: StreamChatTheme.of(context)
|
||||||
_buildDeleteButton(context),
|
.colorTheme
|
||||||
],
|
.greyWhisper,
|
||||||
).toList(),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -416,136 +417,131 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildReplyButton(BuildContext context) {
|
Widget _buildReplyButton(BuildContext context) {
|
||||||
return ListTile(
|
return InkWell(
|
||||||
dense: true,
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.reply(
|
|
||||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
'Reply',
|
|
||||||
style: StreamChatTheme.of(context).textTheme.headline,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
if (widget.onReplyTap != null) {
|
if (widget.onReplyTap != null) {
|
||||||
widget.onReplyTap(widget.message);
|
widget.onReplyTap(widget.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
StreamSvgIcon.reply(
|
||||||
|
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
'Reply',
|
||||||
|
style: StreamChatTheme.of(context).textTheme.body,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFlagButton(BuildContext context) {
|
Widget _buildFlagButton(BuildContext context) {
|
||||||
return ListTile(
|
return InkWell(
|
||||||
dense: true,
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.icon_flag(
|
|
||||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
'Flag',
|
|
||||||
style: StreamChatTheme.of(context).textTheme.headline,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () => _showFlagDialog(),
|
onTap: () => _showFlagDialog(),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
StreamSvgIcon.icon_flag(
|
||||||
|
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
'Flag',
|
||||||
|
style: StreamChatTheme.of(context).textTheme.body,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDeleteButton(BuildContext context) {
|
Widget _buildDeleteButton(BuildContext context) {
|
||||||
final isDeleteFailed =
|
final isDeleteFailed =
|
||||||
widget.message.status == MessageSendingStatus.FAILED_DELETE;
|
widget.message.status == MessageSendingStatus.FAILED_DELETE;
|
||||||
return ListTile(
|
return InkWell(
|
||||||
dense: true,
|
onTap: () => _showDeleteDialog(),
|
||||||
title: Row(
|
child: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
StreamSvgIcon.delete(
|
child: Row(
|
||||||
color: Colors.red,
|
children: [
|
||||||
),
|
StreamSvgIcon.delete(
|
||||||
const SizedBox(width: 16),
|
color: Colors.red,
|
||||||
Text(
|
),
|
||||||
isDeleteFailed ? 'Retry Deleting Message' : 'Delete Message',
|
const SizedBox(width: 16),
|
||||||
style: StreamChatTheme.of(context)
|
Text(
|
||||||
.textTheme
|
isDeleteFailed ? 'Retry Deleting Message' : 'Delete Message',
|
||||||
.headline
|
style: StreamChatTheme.of(context)
|
||||||
.copyWith(color: Colors.red),
|
.textTheme
|
||||||
),
|
.body
|
||||||
],
|
.copyWith(color: Colors.red),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onTap: () {
|
|
||||||
_showDeleteDialog();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCopyButton(BuildContext context) {
|
Widget _buildCopyButton(BuildContext context) {
|
||||||
return ListTile(
|
return InkWell(
|
||||||
dense: true,
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.copy(
|
|
||||||
size: 24,
|
|
||||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
'Copy Message',
|
|
||||||
style: StreamChatTheme.of(context).textTheme.headline,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Clipboard.setData(ClipboardData(text: widget.message.text));
|
await Clipboard.setData(ClipboardData(text: widget.message.text));
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
StreamSvgIcon.copy(
|
||||||
|
size: 24,
|
||||||
|
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
'Copy Message',
|
||||||
|
style: StreamChatTheme.of(context).textTheme.body,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEditMessage(BuildContext context) {
|
Widget _buildEditMessage(BuildContext context) {
|
||||||
return ListTile(
|
return InkWell(
|
||||||
dense: true,
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.edit(
|
|
||||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
'Edit Message',
|
|
||||||
style: StreamChatTheme.of(context).textTheme.headline,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
_showEditBottomSheet(context);
|
_showEditBottomSheet(context);
|
||||||
},
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
StreamSvgIcon.edit(
|
||||||
|
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
'Edit Message',
|
||||||
|
style: StreamChatTheme.of(context).textTheme.body,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildResendMessage(BuildContext context) {
|
Widget _buildResendMessage(BuildContext context) {
|
||||||
final isUpdateFailed =
|
final isUpdateFailed =
|
||||||
widget.message.status == MessageSendingStatus.FAILED_UPDATE;
|
widget.message.status == MessageSendingStatus.FAILED_UPDATE;
|
||||||
return ListTile(
|
return InkWell(
|
||||||
dense: true,
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.circle_up(
|
|
||||||
color: StreamChatTheme.of(context).colorTheme.accentBlue,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
isUpdateFailed ? 'Resend Edited Message' : 'Resend',
|
|
||||||
style: StreamChatTheme.of(context).textTheme.headline,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
final client = StreamChat.of(context).client;
|
final client = StreamChat.of(context).client;
|
||||||
@@ -556,6 +552,21 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
channel.sendMessage(widget.message);
|
channel.sendMessage(widget.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
StreamSvgIcon.circle_up(
|
||||||
|
color: StreamChatTheme.of(context).colorTheme.accentBlue,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
isUpdateFailed ? 'Resend Edited Message' : 'Resend',
|
||||||
|
style: StreamChatTheme.of(context).textTheme.body,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,26 +640,28 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildThreadReplyButton(BuildContext context) {
|
Widget _buildThreadReplyButton(BuildContext context) {
|
||||||
return ListTile(
|
return InkWell(
|
||||||
dense: true,
|
|
||||||
title: Row(
|
|
||||||
children: [
|
|
||||||
StreamSvgIcon.thread(
|
|
||||||
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
'Thread Reply',
|
|
||||||
style: StreamChatTheme.of(context).textTheme.headline,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
if (widget.onThreadReplyTap != null) {
|
if (widget.onThreadReplyTap != null) {
|
||||||
widget.onThreadReplyTap(widget.message);
|
widget.onThreadReplyTap(widget.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
StreamSvgIcon.thread(
|
||||||
|
color: StreamChatTheme.of(context).primaryIconTheme.color,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
'Thread Reply',
|
||||||
|
style: StreamChatTheme.of(context).textTheme.body,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user