💄 Optimize message action area
This commit is contained in:
@@ -383,37 +383,9 @@ class MessageHoverActionMenu extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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: [
|
||||
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),
|
||||
),
|
||||
// General actions (available for all users)
|
||||
final generalActions = [
|
||||
if (!isCurrentUser) // Hide reply for message author
|
||||
IconButton(
|
||||
icon: Icon(Symbols.reply, size: 16),
|
||||
onPressed: () => onAction?.call(MessageItemAction.reply),
|
||||
@@ -437,6 +409,55 @@ class MessageHoverActionMenu extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(8),
|
||||
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