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