diff --git a/lib/pages/chat_page.dart b/lib/pages/chat_page.dart index ee2f4d0..7aa8156 100644 --- a/lib/pages/chat_page.dart +++ b/lib/pages/chat_page.dart @@ -16,7 +16,7 @@ class ChatPage extends ConsumerWidget { body: Builder( builder: (context) => Row( children: [ - if (isDesktop) Sidebar(), + if (isDesktop) Sidebar(isDesktop: isDesktop), Expanded( child: RoomChat( isDesktop: isDesktop, @@ -26,7 +26,7 @@ class ChatPage extends ConsumerWidget { ], ), ), - drawer: isDesktop ? null : Sidebar(), + drawer: isDesktop ? null : Sidebar(isDesktop: isDesktop), ); }, ); diff --git a/lib/widgets/chat_page/sidebar.dart b/lib/widgets/chat_page/sidebar.dart index 4642a58..771a7ae 100644 --- a/lib/widgets/chat_page/sidebar.dart +++ b/lib/widgets/chat_page/sidebar.dart @@ -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(); + }, ), ), ),