[MessageActionModal] Fix action tile padding and divider

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-13 16:24:55 +05:30
parent 829dddb5e0
commit 854aea1fa2
+83 -70
View File
@@ -186,12 +186,7 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
child: Column(
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: ListTile.divideTiles(
color: StreamChatTheme.of(context)
.colorTheme
.greyWhisper,
context: context,
tiles: [
children: [
if (widget.showReplyMessage &&
(widget.message.status ==
MessageSendingStatus.SENT ||
@@ -214,8 +209,14 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
_buildFlagButton(context),
if (widget.showDeleteMessage)
_buildDeleteButton(context),
],
).toList(),
].insertBetween(
Container(
height: 1,
color: StreamChatTheme.of(context)
.colorTheme
.greyWhisper,
),
),
),
),
),
@@ -416,9 +417,16 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
}
Widget _buildReplyButton(BuildContext context) {
return ListTile(
dense: true,
title: Row(
return InkWell(
onTap: () {
Navigator.pop(context);
if (widget.onReplyTap != null) {
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,
@@ -426,23 +434,20 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16),
Text(
'Reply',
style: StreamChatTheme.of(context).textTheme.headline,
style: StreamChatTheme.of(context).textTheme.body,
),
],
),
onTap: () {
Navigator.pop(context);
if (widget.onReplyTap != null) {
widget.onReplyTap(widget.message);
}
},
),
);
}
Widget _buildFlagButton(BuildContext context) {
return ListTile(
dense: true,
title: Row(
return InkWell(
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,
@@ -450,20 +455,22 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16),
Text(
'Flag',
style: StreamChatTheme.of(context).textTheme.headline,
style: StreamChatTheme.of(context).textTheme.body,
),
],
),
onTap: () => _showFlagDialog(),
),
);
}
Widget _buildDeleteButton(BuildContext context) {
final isDeleteFailed =
widget.message.status == MessageSendingStatus.FAILED_DELETE;
return ListTile(
dense: true,
title: Row(
return InkWell(
onTap: () => _showDeleteDialog(),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
child: Row(
children: [
StreamSvgIcon.delete(
color: Colors.red,
@@ -473,21 +480,24 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
isDeleteFailed ? 'Retry Deleting Message' : 'Delete Message',
style: StreamChatTheme.of(context)
.textTheme
.headline
.body
.copyWith(color: Colors.red),
),
],
),
onTap: () {
_showDeleteDialog();
},
),
);
}
Widget _buildCopyButton(BuildContext context) {
return ListTile(
dense: true,
title: Row(
return InkWell(
onTap: () async {
await Clipboard.setData(ClipboardData(text: widget.message.text));
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
child: Row(
children: [
StreamSvgIcon.copy(
size: 24,
@@ -496,21 +506,23 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16),
Text(
'Copy Message',
style: StreamChatTheme.of(context).textTheme.headline,
style: StreamChatTheme.of(context).textTheme.body,
),
],
),
onTap: () async {
await Clipboard.setData(ClipboardData(text: widget.message.text));
Navigator.pop(context);
},
),
);
}
Widget _buildEditMessage(BuildContext context) {
return ListTile(
dense: true,
title: Row(
return InkWell(
onTap: () async {
Navigator.pop(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,
@@ -518,34 +530,18 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16),
Text(
'Edit Message',
style: StreamChatTheme.of(context).textTheme.headline,
style: StreamChatTheme.of(context).textTheme.body,
),
],
),
onTap: () async {
Navigator.pop(context);
_showEditBottomSheet(context);
},
),
);
}
Widget _buildResendMessage(BuildContext context) {
final isUpdateFailed =
widget.message.status == MessageSendingStatus.FAILED_UPDATE;
return ListTile(
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,
),
],
),
return InkWell(
onTap: () {
Navigator.pop(context);
final client = StreamChat.of(context).client;
@@ -556,6 +552,21 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
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,9 +640,16 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
}
Widget _buildThreadReplyButton(BuildContext context) {
return ListTile(
dense: true,
title: Row(
return InkWell(
onTap: () {
Navigator.pop(context);
if (widget.onThreadReplyTap != null) {
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,
@@ -639,16 +657,11 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16),
Text(
'Thread Reply',
style: StreamChatTheme.of(context).textTheme.headline,
style: StreamChatTheme.of(context).textTheme.body,
),
],
),
onTap: () {
Navigator.pop(context);
if (widget.onThreadReplyTap != null) {
widget.onThreadReplyTap(widget.message);
}
},
),
);
}
}