From 7f6e37adf2d11627e33bdba8630822c42d35442f Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sun, 19 Sep 2021 12:40:53 +0200 Subject: [PATCH] fix: Account switcher --- lib/pages/chat_list.dart | 13 ++++++++----- lib/pages/views/chat_list_view.dart | 7 ++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/pages/chat_list.dart b/lib/pages/chat_list.dart index 4b0aa6ac..89ec3435 100644 --- a/lib/pages/chat_list.dart +++ b/lib/pages/chat_list.dart @@ -410,11 +410,14 @@ class ChatListController extends State { } } - void setActiveClient(Client client) => setState(() { - _activeSpaceId = null; - selectedRoomIds.clear(); - Matrix.of(context).setActiveClient(client); - }); + void setActiveClient(Client client) { + VRouter.of(context).to('/rooms'); + setState(() { + _activeSpaceId = null; + selectedRoomIds.clear(); + Matrix.of(context).setActiveClient(client); + }); + } void setActiveBundle(String bundle) => setState(() { _activeSpaceId = null; diff --git a/lib/pages/views/chat_list_view.dart b/lib/pages/views/chat_list_view.dart index 9b4f5755..18604232 100644 --- a/lib/pages/views/chat_list_view.dart +++ b/lib/pages/views/chat_list_view.dart @@ -348,7 +348,12 @@ class ChatListView extends StatelessWidget { child: SizedBox( width: double.infinity, child: CupertinoSlidingSegmentedControl( - groupValue: Matrix.of(context).activeBundle, + groupValue: + Matrix.of(context).activeBundle ?? + Matrix.of(context) + .accountBundles + .keys + .first, onValueChanged: controller.setActiveBundle, children: Map.fromEntries(Matrix.of(context) .accountBundles