💄 Optimize message action area
This commit is contained in:
@@ -383,37 +383,9 @@ class MessageHoverActionMenu extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
// General actions (available for all users)
|
||||||
decoration: BoxDecoration(
|
final generalActions = [
|
||||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
if (!isCurrentUser) // Hide reply for message author
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withOpacity(0.1),
|
|
||||||
blurRadius: 4,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
if (isCurrentUser)
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Symbols.edit, size: 16),
|
|
||||||
onPressed: () => onAction?.call(MessageItemAction.edit),
|
|
||||||
tooltip: 'edit'.tr(),
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
|
||||||
),
|
|
||||||
if (isCurrentUser)
|
|
||||||
IconButton(
|
|
||||||
icon: Icon(Symbols.delete, size: 16),
|
|
||||||
onPressed: () => _handleDelete(context),
|
|
||||||
tooltip: 'delete'.tr(),
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
|
||||||
),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Symbols.reply, size: 16),
|
icon: Icon(Symbols.reply, size: 16),
|
||||||
onPressed: () => onAction?.call(MessageItemAction.reply),
|
onPressed: () => onAction?.call(MessageItemAction.reply),
|
||||||
@@ -437,6 +409,55 @@ class MessageHoverActionMenu extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
||||||
),
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
// Author-only actions (edit/delete)
|
||||||
|
final authorActions = [
|
||||||
|
if (isCurrentUser)
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Symbols.edit, size: 16),
|
||||||
|
onPressed: () => onAction?.call(MessageItemAction.edit),
|
||||||
|
tooltip: 'edit'.tr(),
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
||||||
|
),
|
||||||
|
if (isCurrentUser)
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Symbols.delete, size: 16, color: Colors.red),
|
||||||
|
onPressed: () => _handleDelete(context),
|
||||||
|
tooltip: 'delete'.tr(),
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
constraints: const BoxConstraints(minWidth: 32, minHeight: 32),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 4,
|
||||||
|
offset: const Offset(0, 2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// General actions (left side)
|
||||||
|
...generalActions,
|
||||||
|
// Separator (only if both general and author actions exist)
|
||||||
|
if (generalActions.isNotEmpty && authorActions.isNotEmpty)
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 24,
|
||||||
|
color: Theme.of(context).colorScheme.outlineVariant,
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
|
),
|
||||||
|
// Author actions (right side)
|
||||||
|
...authorActions,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user