From c96671b29b5e73703db16dbec2854239a604dcfa Mon Sep 17 00:00:00 2001 From: ggurdin Date: Fri, 14 Jun 2024 09:32:47 -0400 Subject: [PATCH] Don't show subspaces in top-level spaces lists --- lib/pages/chat_list/chat_list_view.dart | 23 +++++++++----------- lib/pages/chat_list/space_view.dart | 28 ++++++++++++------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/lib/pages/chat_list/chat_list_view.dart b/lib/pages/chat_list/chat_list_view.dart index 5736cad77..10ed00edd 100644 --- a/lib/pages/chat_list/chat_list_view.dart +++ b/lib/pages/chat_list/chat_list_view.dart @@ -138,17 +138,14 @@ class ChatListView extends StatelessWidget { builder: (context) { final allSpaces = client.rooms.where((room) => room.isSpace); - // #Pangea - // final rootSpaces = allSpaces - // .where( - // (space) => !allSpaces.any( - // (parentSpace) => parentSpace.spaceChildren - // .any((child) => child.roomId == space.id), - // ), - // ) - // .toList(); - final rootSpaces = allSpaces.toList(); - // Pangea# + final rootSpaces = allSpaces + .where( + (space) => !allSpaces.any( + (parentSpace) => parentSpace.spaceChildren + .any((child) => child.roomId == space.id), + ), + ) + .toList(); final destinations = getNavigationDestinations(context); return SizedBox( @@ -228,9 +225,9 @@ class ChatListView extends StatelessWidget { NavigationDestinationLabelBehavior.alwaysHide, height: 64, shadowColor: - Theme.of(context).colorScheme.onBackground, + Theme.of(context).colorScheme.onSurface, surfaceTintColor: - Theme.of(context).colorScheme.background, + Theme.of(context).colorScheme.surface, selectedIndex: controller.selectedIndex, onDestinationSelected: controller.onDestinationSelected, diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index 2cdfed64a..e7237ccba 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -572,21 +572,19 @@ class _SpaceViewState extends State { final allSpaces = client.rooms.where((room) => room.isSpace); if (activeSpaceId == null) { final rootSpaces = allSpaces - // #Pangea - // .where( - // (space) => - // !allSpaces.any( - // (parentSpace) => parentSpace.spaceChildren - // .any((child) => child.roomId == space.id), - // ) && - // space - // .getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)) - // .toLowerCase() - // .contains( - // widget.controller.searchController.text.toLowerCase(), - // ), - //) - // Pangea# + .where( + (space) => + !allSpaces.any( + (parentSpace) => parentSpace.spaceChildren + .any((child) => child.roomId == space.id), + ) && + space + .getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)) + .toLowerCase() + .contains( + widget.controller.searchController.text.toLowerCase(), + ), + ) .toList(); return SafeArea(