fix: simplify chat context menu
This commit is contained in:
@@ -525,7 +525,7 @@ class ChatListController extends State<ChatList>
|
||||
)
|
||||
.toList();
|
||||
|
||||
var action = await showModalActionPopup<ChatContextAction>(
|
||||
final action = await showModalActionPopup<ChatContextAction>(
|
||||
context: posContext,
|
||||
cancelLabel: l10n.cancel,
|
||||
actions: [
|
||||
@@ -564,36 +564,6 @@ class ChatListController extends State<ChatList>
|
||||
room.isFavourite ? Icons.push_pin : Icons.push_pin_outlined,
|
||||
),
|
||||
),
|
||||
],
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.leave,
|
||||
label: room.membership == Membership.invite
|
||||
? l10n.delete
|
||||
: l10n.leave,
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
isDestructive: true,
|
||||
),
|
||||
if (room.membership == Membership.invite)
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.block,
|
||||
label: l10n.block,
|
||||
icon: const Icon(Icons.block_outlined),
|
||||
isDestructive: true,
|
||||
),
|
||||
if (room.membership == Membership.join)
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.showMore,
|
||||
label: l10n.more,
|
||||
icon: Icon(Icons.adaptive.more_outlined),
|
||||
),
|
||||
],
|
||||
);
|
||||
if (!posContext.mounted || !mounted) return;
|
||||
if (action == ChatContextAction.showMore) {
|
||||
action = await showModalActionPopup<ChatContextAction>(
|
||||
context: posContext,
|
||||
cancelLabel: l10n.cancel,
|
||||
actions: [
|
||||
if (!room.isFavourite)
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.lowPriority,
|
||||
@@ -625,8 +595,24 @@ class ChatListController extends State<ChatList>
|
||||
icon: const Icon(Icons.group_work_outlined),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.leave,
|
||||
label: room.membership == Membership.invite
|
||||
? l10n.delete
|
||||
: l10n.leave,
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
isDestructive: true,
|
||||
),
|
||||
if (room.membership == Membership.invite)
|
||||
AdaptiveModalAction(
|
||||
value: ChatContextAction.block,
|
||||
label: l10n.block,
|
||||
icon: const Icon(Icons.block_outlined),
|
||||
isDestructive: true,
|
||||
),
|
||||
],
|
||||
);
|
||||
if (!posContext.mounted || !mounted) return;
|
||||
|
||||
if (action == null) return;
|
||||
if (!mounted) return;
|
||||
@@ -753,8 +739,6 @@ class ChatListController extends State<ChatList>
|
||||
future: () => room.removeTag(activeTag!),
|
||||
);
|
||||
return;
|
||||
case ChatContextAction.showMore:
|
||||
throw ('Should not be handled!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1021,5 +1005,4 @@ enum ChatContextAction {
|
||||
leave,
|
||||
addToSpace,
|
||||
block,
|
||||
showMore,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user