make sidebar auto collapse when selecting a room on the mobile layout
This commit is contained in:
parent
840f2fe464
commit
b387f0755a
2 changed files with 10 additions and 6 deletions
|
|
@ -16,7 +16,7 @@ class ChatPage extends ConsumerWidget {
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (context) => Row(
|
builder: (context) => Row(
|
||||||
children: [
|
children: [
|
||||||
if (isDesktop) Sidebar(),
|
if (isDesktop) Sidebar(isDesktop: isDesktop),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: RoomChat(
|
child: RoomChat(
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
|
|
@ -26,7 +26,7 @@ class ChatPage extends ConsumerWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
drawer: isDesktop ? null : Sidebar(),
|
drawer: isDesktop ? null : Sidebar(isDesktop: isDesktop),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ import "package:nexus/widgets/chat_page/room_menu.dart";
|
||||||
import "package:nexus/widgets/form_text_input.dart";
|
import "package:nexus/widgets/form_text_input.dart";
|
||||||
|
|
||||||
class Sidebar extends HookConsumerWidget {
|
class Sidebar extends HookConsumerWidget {
|
||||||
const Sidebar({super.key});
|
final bool isDesktop;
|
||||||
|
const Sidebar({required this.isDesktop, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
|
@ -220,9 +221,12 @@ class Sidebar extends HookConsumerWidget {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
onDestinationSelected: (value) => selectedRoomIdNotifier.set(
|
onDestinationSelected: (value) {
|
||||||
selectedSpace.children[value].metadata?.id,
|
selectedRoomIdNotifier.set(
|
||||||
),
|
selectedSpace.children[value].metadata?.id,
|
||||||
|
);
|
||||||
|
if (!isDesktop) Navigator.of(context).pop();
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue