diff --git a/lib/pages/chat_list/chat_list_body.dart b/lib/pages/chat_list/chat_list_body.dart index 1d1705ca1..d2f90fc30 100644 --- a/lib/pages/chat_list/chat_list_body.dart +++ b/lib/pages/chat_list/chat_list_body.dart @@ -40,6 +40,16 @@ class ChatListViewBody extends StatelessWidget { toParentSpace: controller.setActiveSpace, ); } + final spaces = client.rooms.where((r) => r.isSpace); + final spaceDelegateCandidates = {}; + for (final space in spaces) { + for (final spaceChild in space.spaceChildren) { + final roomId = spaceChild.roomId; + if (roomId == null) continue; + spaceDelegateCandidates[roomId] = space; + } + } + final publicRooms = controller.roomSearchResult?.chunk .where((room) => room.roomType != 'm.space') .toList(); @@ -63,16 +73,6 @@ class ChatListViewBody extends StatelessWidget { builder: (context, _) { final rooms = controller.filteredRooms; - final spaces = client.rooms.where((r) => r.isSpace); - final spaceDelegateCandidates = {}; - for (final space in spaces) { - for (final spaceChild in space.spaceChildren) { - final roomId = spaceChild.roomId; - if (roomId == null) continue; - spaceDelegateCandidates[roomId] = space; - } - } - return SafeArea( child: CustomScrollView( controller: controller.scrollController,