[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( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.stretch, CrossAxisAlignment.stretch,
children: ListTile.divideTiles( children: [
color: StreamChatTheme.of(context)
.colorTheme
.greyWhisper,
context: context,
tiles: [
if (widget.showReplyMessage && if (widget.showReplyMessage &&
(widget.message.status == (widget.message.status ==
MessageSendingStatus.SENT || MessageSendingStatus.SENT ||
@@ -214,8 +209,14 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
_buildFlagButton(context), _buildFlagButton(context),
if (widget.showDeleteMessage) if (widget.showDeleteMessage)
_buildDeleteButton(context), _buildDeleteButton(context),
], ].insertBetween(
).toList(), Container(
height: 1,
color: StreamChatTheme.of(context)
.colorTheme
.greyWhisper,
),
),
), ),
), ),
), ),
@@ -416,9 +417,16 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
} }
Widget _buildReplyButton(BuildContext context) { Widget _buildReplyButton(BuildContext context) {
return ListTile( return InkWell(
dense: true, onTap: () {
title: Row( 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: [ children: [
StreamSvgIcon.reply( StreamSvgIcon.reply(
color: StreamChatTheme.of(context).primaryIconTheme.color, color: StreamChatTheme.of(context).primaryIconTheme.color,
@@ -426,23 +434,20 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16), const SizedBox(width: 16),
Text( Text(
'Reply', '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) { Widget _buildFlagButton(BuildContext context) {
return ListTile( return InkWell(
dense: true, onTap: () => _showFlagDialog(),
title: Row( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
child: Row(
children: [ children: [
StreamSvgIcon.icon_flag( StreamSvgIcon.icon_flag(
color: StreamChatTheme.of(context).primaryIconTheme.color, color: StreamChatTheme.of(context).primaryIconTheme.color,
@@ -450,20 +455,22 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16), const SizedBox(width: 16),
Text( Text(
'Flag', 'Flag',
style: StreamChatTheme.of(context).textTheme.headline, style: StreamChatTheme.of(context).textTheme.body,
), ),
], ],
), ),
onTap: () => _showFlagDialog(), ),
); );
} }
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(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
child: Row(
children: [ children: [
StreamSvgIcon.delete( StreamSvgIcon.delete(
color: Colors.red, color: Colors.red,
@@ -473,21 +480,24 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
isDeleteFailed ? 'Retry Deleting Message' : 'Delete Message', isDeleteFailed ? 'Retry Deleting Message' : 'Delete Message',
style: StreamChatTheme.of(context) style: StreamChatTheme.of(context)
.textTheme .textTheme
.headline .body
.copyWith(color: Colors.red), .copyWith(color: Colors.red),
), ),
], ],
), ),
onTap: () { ),
_showDeleteDialog();
},
); );
} }
Widget _buildCopyButton(BuildContext context) { Widget _buildCopyButton(BuildContext context) {
return ListTile( return InkWell(
dense: true, onTap: () async {
title: Row( 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: [ children: [
StreamSvgIcon.copy( StreamSvgIcon.copy(
size: 24, size: 24,
@@ -496,21 +506,23 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16), const SizedBox(width: 16),
Text( Text(
'Copy Message', '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) { Widget _buildEditMessage(BuildContext context) {
return ListTile( return InkWell(
dense: true, onTap: () async {
title: Row( Navigator.pop(context);
_showEditBottomSheet(context);
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
child: Row(
children: [ children: [
StreamSvgIcon.edit( StreamSvgIcon.edit(
color: StreamChatTheme.of(context).primaryIconTheme.color, color: StreamChatTheme.of(context).primaryIconTheme.color,
@@ -518,34 +530,18 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16), const SizedBox(width: 16),
Text( Text(
'Edit Message', '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) { 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,9 +640,16 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
} }
Widget _buildThreadReplyButton(BuildContext context) { Widget _buildThreadReplyButton(BuildContext context) {
return ListTile( return InkWell(
dense: true, onTap: () {
title: Row( 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: [ children: [
StreamSvgIcon.thread( StreamSvgIcon.thread(
color: StreamChatTheme.of(context).primaryIconTheme.color, color: StreamChatTheme.of(context).primaryIconTheme.color,
@@ -639,16 +657,11 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
const SizedBox(width: 16), const SizedBox(width: 16),
Text( Text(
'Thread Reply', '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);
}
},
); );
} }
} }