make sidebar auto collapse when selecting a room on the mobile layout

This commit is contained in:
Henry Hiles 2026-03-24 16:45:25 -04:00
commit b387f0755a
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 10 additions and 6 deletions

View file

@ -12,7 +12,8 @@ import "package:nexus/widgets/chat_page/room_menu.dart";
import "package:nexus/widgets/form_text_input.dart";
class Sidebar extends HookConsumerWidget {
const Sidebar({super.key});
final bool isDesktop;
const Sidebar({required this.isDesktop, super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@ -220,9 +221,12 @@ class Sidebar extends HookConsumerWidget {
),
)
.toList(),
onDestinationSelected: (value) => selectedRoomIdNotifier.set(
selectedSpace.children[value].metadata?.id,
),
onDestinationSelected: (value) {
selectedRoomIdNotifier.set(
selectedSpace.children[value].metadata?.id,
);
if (!isDesktop) Navigator.of(context).pop();
},
),
),
),