chore: Follow up select chats
This commit is contained in:
parent
64c56f889b
commit
7b0e0404c0
3 changed files with 24 additions and 10 deletions
|
|
@ -2705,5 +2705,10 @@
|
|||
"restricted": "Restricted",
|
||||
"@restricted": {},
|
||||
"knockRestricted": "Knock restricted",
|
||||
"@knockRestricted": {}
|
||||
"@knockRestricted": {},
|
||||
"goToSpace": "Go to space: {space}",
|
||||
"@goToSpace": {
|
||||
"type": "text",
|
||||
"space": {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -612,19 +612,22 @@ class ChatListController extends State<ChatList>
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
void chatContextAction(Room room) async {
|
||||
void chatContextAction(Room room, [Room? space]) async {
|
||||
final action = await showModalActionSheet<ChatContextAction>(
|
||||
context: context,
|
||||
title: room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
||||
actions: [
|
||||
if (space != null)
|
||||
SheetAction(
|
||||
key: ChatContextAction.goToSpace,
|
||||
icon: Icons.workspaces_outlined,
|
||||
label: L10n.of(context)!.goToSpace(space.getLocalizedDisplayname()),
|
||||
),
|
||||
SheetAction(
|
||||
key: ChatContextAction.markUnread,
|
||||
icon: room.markedUnread
|
||||
? Icons.mark_as_unread
|
||||
: Icons.mark_as_unread_outlined,
|
||||
label: room.markedUnread
|
||||
? L10n.of(context)!.markAsRead
|
||||
: L10n.of(context)!.unread,
|
||||
label: L10n.of(context)!.toggleUnread,
|
||||
),
|
||||
SheetAction(
|
||||
key: ChatContextAction.favorite,
|
||||
|
|
@ -656,8 +659,11 @@ class ChatListController extends State<ChatList>
|
|||
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () {
|
||||
future: () async {
|
||||
switch (action) {
|
||||
case ChatContextAction.goToSpace:
|
||||
setActiveSpace(space!.id);
|
||||
return;
|
||||
case ChatContextAction.favorite:
|
||||
return room.setFavourite(!room.isFavourite);
|
||||
case ChatContextAction.markUnread:
|
||||
|
|
@ -872,6 +878,7 @@ enum InviteActions {
|
|||
enum AddRoomType { chat, subspace }
|
||||
|
||||
enum ChatContextAction {
|
||||
goToSpace,
|
||||
favorite,
|
||||
markUnread,
|
||||
mute,
|
||||
|
|
|
|||
|
|
@ -27,13 +27,15 @@ class ChatListViewBody extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final client = Matrix.of(context).client;
|
||||
final activeSpace = controller.activeSpaceId;
|
||||
if (activeSpace != null) {
|
||||
return SpaceView(
|
||||
spaceId: activeSpace,
|
||||
onBack: controller.clearActiveSpace,
|
||||
onChatTab: (room) => controller.onChatTap(room),
|
||||
onChatContext: (room) => controller.chatContextAction(room),
|
||||
onChatContext: (room) =>
|
||||
controller.chatContextAction(room, client.getRoomById(activeSpace)),
|
||||
activeChat: controller.activeChat,
|
||||
toParentSpace: controller.setActiveSpace,
|
||||
);
|
||||
|
|
@ -45,7 +47,6 @@ class ChatListViewBody extends StatelessWidget {
|
|||
.where((room) => room.roomType == 'm.space')
|
||||
.toList();
|
||||
final userSearchResult = controller.userSearchResult;
|
||||
final client = Matrix.of(context).client;
|
||||
const dummyChatCount = 4;
|
||||
final titleColor =
|
||||
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100);
|
||||
|
|
@ -304,7 +305,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||
key: Key('chat_list_item_${room.id}'),
|
||||
filter: filter,
|
||||
onTap: () => controller.onChatTap(room),
|
||||
onLongPress: () => controller.chatContextAction(room),
|
||||
onLongPress: () =>
|
||||
controller.chatContextAction(room, space),
|
||||
activeChat: controller.activeChat == room.id,
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue