From cf59a43511ee7e7f8fa0a704ee5beccffaae108b Mon Sep 17 00:00:00 2001 From: Krille Date: Fri, 19 Jul 2024 14:50:17 +0200 Subject: [PATCH 1/7] chore: Follow up avatar default image --- lib/widgets/avatar.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/widgets/avatar.dart b/lib/widgets/avatar.dart index 28524d917..c95444c74 100644 --- a/lib/widgets/avatar.dart +++ b/lib/widgets/avatar.dart @@ -47,8 +47,9 @@ class Avatar extends StatelessWidget { final noPic = mxContent == null || mxContent.toString().isEmpty || mxContent.toString() == 'null'; + final textColor = name?.lightColorAvatar; final textWidget = Container( - color: name?.lightColorAvatar, + color: textColor, alignment: Alignment.center, child: Text( fallbackLetters, @@ -81,7 +82,13 @@ class Avatar extends StatelessWidget { fit: BoxFit.cover, width: size, height: size, - placeholder: (_) => textWidget, + placeholder: (_) => Center( + child: Icon( + Icons.person_2, + color: textColor, + size: size / 1.5, + ), + ), ), ), ), From 152fcc0d95bcba4acc8c3920fba358016cd547ee Mon Sep 17 00:00:00 2001 From: Krille Date: Fri, 19 Jul 2024 15:01:51 +0200 Subject: [PATCH 2/7] chore: Improved create group and space design --- lib/pages/new_group/new_group.dart | 7 --- lib/pages/new_group/new_group_view.dart | 61 +++++++------------ lib/pages/new_space/new_space_view.dart | 79 +++++++++---------------- 3 files changed, 50 insertions(+), 97 deletions(-) diff --git a/lib/pages/new_group/new_group.dart b/lib/pages/new_group/new_group.dart index 584a3f885..83a8b478e 100644 --- a/lib/pages/new_group/new_group.dart +++ b/lib/pages/new_group/new_group.dart @@ -19,8 +19,6 @@ class NewGroup extends StatefulWidget { class NewGroupController extends State { TextEditingController nameController = TextEditingController(); - TextEditingController topicController = TextEditingController(); - bool publicGroup = false; bool groupCanBeFound = true; @@ -71,11 +69,6 @@ class NewGroupController extends State { : sdk.CreateRoomPreset.privateChat, groupName: nameController.text.isNotEmpty ? nameController.text : null, initialState: [ - if (topicController.text.isNotEmpty) - sdk.StateEvent( - type: sdk.EventTypes.RoomTopic, - content: {'topic': topicController.text}, - ), if (avatar != null) sdk.StateEvent( type: sdk.EventTypes.RoomAvatar, diff --git a/lib/pages/new_group/new_group_view.dart b/lib/pages/new_group/new_group_view.dart index a00ba3754..a83497d7b 100644 --- a/lib/pages/new_group/new_group_view.dart +++ b/lib/pages/new_group/new_group_view.dart @@ -31,54 +31,35 @@ class NewGroupView extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ const SizedBox(height: 16), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Row( - children: [ - InkWell( - borderRadius: BorderRadius.circular(90), - onTap: controller.loading ? null : controller.selectPhoto, - child: CircleAvatar( - radius: Avatar.defaultSize / 2, - child: avatar == null - ? const Icon(Icons.camera_alt_outlined) - : ClipRRect( - borderRadius: BorderRadius.circular(90), - child: Image.memory( - avatar, - width: Avatar.defaultSize, - height: Avatar.defaultSize, - fit: BoxFit.cover, - ), - ), - ), - ), - const SizedBox(width: 16), - Expanded( - child: TextField( - controller: controller.nameController, - autocorrect: false, - readOnly: controller.loading, - decoration: InputDecoration( - prefixIcon: const Icon(Icons.people_outlined), - hintText: L10n.of(context)!.groupName, + InkWell( + borderRadius: BorderRadius.circular(90), + onTap: controller.loading ? null : controller.selectPhoto, + child: CircleAvatar( + radius: Avatar.defaultSize, + child: avatar == null + ? const Icon(Icons.add_a_photo_outlined) + : ClipRRect( + borderRadius: BorderRadius.circular(90), + child: Image.memory( + avatar, + width: Avatar.defaultSize, + height: Avatar.defaultSize, + fit: BoxFit.cover, + ), ), - ), - ), - ], ), ), - const SizedBox(height: 16), + const SizedBox(height: 32), Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: TextField( - controller: controller.topicController, - minLines: 4, - maxLines: 4, - maxLength: 255, + autofocus: true, + controller: controller.nameController, + autocorrect: false, readOnly: controller.loading, decoration: InputDecoration( - hintText: L10n.of(context)!.addChatDescription, + prefixIcon: const Icon(Icons.people_outlined), + hintText: L10n.of(context)!.groupName, ), ), ), diff --git a/lib/pages/new_space/new_space_view.dart b/lib/pages/new_space/new_space_view.dart index eb464855e..e90c7a84e 100644 --- a/lib/pages/new_space/new_space_view.dart +++ b/lib/pages/new_space/new_space_view.dart @@ -22,65 +22,37 @@ class NewSpaceView extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - ListTile( - trailing: const Padding( - padding: EdgeInsets.symmetric(horizontal: 16.0), - child: Icon(Icons.info_outlined), - ), - subtitle: Text(L10n.of(context)!.newSpaceDescription), - ), const SizedBox(height: 16), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InkWell( - borderRadius: BorderRadius.circular(90), - onTap: controller.loading ? null : controller.selectPhoto, - child: CircleAvatar( - radius: Avatar.defaultSize / 2, - child: avatar == null - ? const Icon(Icons.camera_alt_outlined) - : ClipRRect( - borderRadius: BorderRadius.circular(90), - child: Image.memory( - avatar, - width: Avatar.defaultSize, - height: Avatar.defaultSize, - fit: BoxFit.cover, - ), - ), - ), - ), - const SizedBox(width: 16), - Expanded( - child: TextField( - controller: controller.nameController, - autocorrect: false, - readOnly: controller.loading, - decoration: InputDecoration( - prefixIcon: const Icon(Icons.people_outlined), - hintText: L10n.of(context)!.spaceName, - errorText: controller.nameError, + InkWell( + borderRadius: BorderRadius.circular(90), + onTap: controller.loading ? null : controller.selectPhoto, + child: CircleAvatar( + radius: Avatar.defaultSize, + child: avatar == null + ? const Icon(Icons.add_a_photo_outlined) + : ClipRRect( + borderRadius: BorderRadius.circular(90), + child: Image.memory( + avatar, + width: Avatar.defaultSize, + height: Avatar.defaultSize, + fit: BoxFit.cover, + ), ), - ), - ), - ], ), ), - const SizedBox(height: 16), + const SizedBox(height: 32), Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: TextField( - controller: controller.topicController, - minLines: 4, - maxLines: 4, - maxLength: 255, + autofocus: true, + controller: controller.nameController, + autocorrect: false, readOnly: controller.loading, decoration: InputDecoration( - hintText: L10n.of(context)!.addChatDescription, - errorText: controller.topicError, + prefixIcon: const Icon(Icons.people_outlined), + hintText: L10n.of(context)!.spaceName, + errorText: controller.nameError, ), ), ), @@ -90,6 +62,13 @@ class NewSpaceView extends StatelessWidget { value: controller.publicGroup, onChanged: controller.setPublicGroup, ), + ListTile( + trailing: const Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0), + child: Icon(Icons.info_outlined), + ), + subtitle: Text(L10n.of(context)!.newSpaceDescription), + ), Padding( padding: const EdgeInsets.all(16.0), child: SizedBox( From 7fef3a69d80f0bd27ad32d5434bdb44bcbf1e10d Mon Sep 17 00:00:00 2001 From: Krille Date: Fri, 19 Jul 2024 15:30:04 +0200 Subject: [PATCH 3/7] chore: Follow up avatars --- lib/widgets/avatar.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/widgets/avatar.dart b/lib/widgets/avatar.dart index c95444c74..a9d12f6a5 100644 --- a/lib/widgets/avatar.dart +++ b/lib/widgets/avatar.dart @@ -55,7 +55,8 @@ class Avatar extends StatelessWidget { fallbackLetters, style: TextStyle( color: Colors.white, - fontSize: (size / 2.5).roundToDouble(), + fontWeight: FontWeight.bold, + fontSize: (size / 3).roundToDouble(), ), ), ); @@ -85,7 +86,7 @@ class Avatar extends StatelessWidget { placeholder: (_) => Center( child: Icon( Icons.person_2, - color: textColor, + color: Theme.of(context).colorScheme.tertiary, size: size / 1.5, ), ), From e178ab44166b7ef17ffa1728c39dc49fe565b02d Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sat, 20 Jul 2024 08:01:06 +0200 Subject: [PATCH 4/7] chore: Follow up avatar background --- lib/widgets/avatar.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/widgets/avatar.dart b/lib/widgets/avatar.dart index a9d12f6a5..c3e24fe16 100644 --- a/lib/widgets/avatar.dart +++ b/lib/widgets/avatar.dart @@ -68,7 +68,9 @@ class Avatar extends StatelessWidget { width: size, height: size, child: Material( - color: Theme.of(context).colorScheme.surfaceContainerLowest, + color: Theme.of(context).brightness == Brightness.light + ? Colors.white + : Colors.black, shape: RoundedRectangleBorder( borderRadius: borderRadius, side: border ?? BorderSide.none, From 0760acaa40a4e30d85f8c0eed35c6df7a7e7e660 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 22 Jul 2024 19:42:27 +0200 Subject: [PATCH 5/7] chore: Bring back separate chat types --- lib/config/app_config.dart | 1 + lib/config/setting_keys.dart | 1 + lib/pages/chat_list/chat_list.dart | 7 ++++++- lib/pages/chat_list/chat_list_body.dart | 7 +++++-- lib/pages/settings_style/settings_style_view.dart | 6 ++++++ lib/widgets/matrix.dart | 4 ++++ 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index 6ee20d337..841d810ec 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -44,6 +44,7 @@ abstract class AppConfig { static bool hideRedactedEvents = false; static bool hideUnknownEvents = true; static bool hideUnimportantStateEvents = true; + static bool separateChatTypes = false; static bool autoplayImages = true; static bool sendTypingNotifications = true; static bool sendPublicReadReceipts = true; diff --git a/lib/config/setting_keys.dart b/lib/config/setting_keys.dart index 5b795b08e..7c0e50df8 100644 --- a/lib/config/setting_keys.dart +++ b/lib/config/setting_keys.dart @@ -4,6 +4,7 @@ abstract class SettingKeys { static const String hideUnknownEvents = 'chat.fluffy.hideUnknownEvents'; static const String hideUnimportantStateEvents = 'chat.fluffy.hideUnimportantStateEvents'; + static const String separateChatTypes = 'chat.fluffy.separateChatTypes'; static const String sentry = 'sentry'; static const String theme = 'theme'; static const String amoledEnabled = 'amoled_enabled'; diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index 50237a569..13ce54053 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -50,8 +50,9 @@ enum PopupMenuAction { enum ActiveFilter { allChats, - unread, + messages, groups, + unread, spaces, } @@ -60,6 +61,8 @@ extension LocalizedActiveFilter on ActiveFilter { switch (this) { case ActiveFilter.allChats: return L10n.of(context)!.all; + case ActiveFilter.messages: + return L10n.of(context)!.messages; case ActiveFilter.unread: return L10n.of(context)!.unread; case ActiveFilter.groups: @@ -321,6 +324,8 @@ class ChatListController extends State switch (activeFilter) { case ActiveFilter.allChats: return (room) => true; + case ActiveFilter.messages: + return (room) => !room.isSpace && room.isDirectChat; case ActiveFilter.groups: return (room) => !room.isSpace && !room.isDirectChat; case ActiveFilter.unread: diff --git a/lib/pages/chat_list/chat_list_body.dart b/lib/pages/chat_list/chat_list_body.dart index e596440b3..d78a88e34 100644 --- a/lib/pages/chat_list/chat_list_body.dart +++ b/lib/pages/chat_list/chat_list_body.dart @@ -165,9 +165,12 @@ class ChatListViewBody extends StatelessWidget { shrinkWrap: true, scrollDirection: Axis.horizontal, children: [ - ActiveFilter.allChats, - ActiveFilter.unread, + if (AppConfig.separateChatTypes) + ActiveFilter.messages + else + ActiveFilter.allChats, ActiveFilter.groups, + ActiveFilter.unread, if (spaceDelegateCandidates.isNotEmpty && !controller.widget.displayNavigationRail) ActiveFilter.spaces, diff --git a/lib/pages/settings_style/settings_style_view.dart b/lib/pages/settings_style/settings_style_view.dart index 0b505d597..86f48fe87 100644 --- a/lib/pages/settings_style/settings_style_view.dart +++ b/lib/pages/settings_style/settings_style_view.dart @@ -185,6 +185,12 @@ class SettingsStyleView extends StatelessWidget { storeKey: SettingKeys.showPresences, defaultValue: AppConfig.showPresences, ), + SettingsSwitchListTile.adaptive( + title: L10n.of(context)!.separateChatTypes, + onChanged: (b) => AppConfig.separateChatTypes = b, + storeKey: SettingKeys.separateChatTypes, + defaultValue: AppConfig.separateChatTypes, + ), Divider( height: 1, color: Theme.of(context).dividerColor, diff --git a/lib/widgets/matrix.dart b/lib/widgets/matrix.dart index 581e3ccff..4de23a2f5 100644 --- a/lib/widgets/matrix.dart +++ b/lib/widgets/matrix.dart @@ -433,6 +433,10 @@ class MatrixState extends State with WidgetsBindingObserver { store.getBool(SettingKeys.hideUnimportantStateEvents) ?? AppConfig.hideUnimportantStateEvents; + AppConfig.separateChatTypes = + store.getBool(SettingKeys.separateChatTypes) ?? + AppConfig.separateChatTypes; + AppConfig.autoplayImages = store.getBool(SettingKeys.autoplayImages) ?? AppConfig.autoplayImages; From a500a91b6bba6ec5ae411de473b76c75829baa2a Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 22 Jul 2024 20:06:07 +0200 Subject: [PATCH 6/7] chore: Follow up add chat or subspace UX --- lib/pages/chat_list/chat_list.dart | 107 ++---------------- lib/pages/chat_list/chat_list_view.dart | 6 +- lib/pages/chat_list/space_view.dart | 141 ++++++++++++++++++++++-- 3 files changed, 145 insertions(+), 109 deletions(-) diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index 13ce54053..befba299a 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -105,107 +105,18 @@ class ChatListController extends State String? _activeSpaceId; String? get activeSpaceId => _activeSpaceId; - void setActiveSpace(String spaceId) => setState(() { - _activeSpaceId = spaceId; - }); + void setActiveSpace(String spaceId) async { + await Matrix.of(context).client.getRoomById(spaceId)!.postLoad(); + + setState(() { + _activeSpaceId = spaceId; + }); + } + void clearActiveSpace() => setState(() { _activeSpaceId = null; }); - void addChatAction() async { - if (activeSpaceId == null) { - context.go('/rooms/newprivatechat'); - return; - } - - final roomType = await showConfirmationDialog( - context: context, - title: L10n.of(context)!.addChatOrSubSpace, - actions: [ - AlertDialogAction( - key: AddRoomType.subspace, - label: L10n.of(context)!.createNewSpace, - ), - AlertDialogAction( - key: AddRoomType.chat, - label: L10n.of(context)!.createGroup, - ), - ], - ); - if (roomType == null) return; - - final names = await showTextInputDialog( - context: context, - title: roomType == AddRoomType.subspace - ? L10n.of(context)!.createNewSpace - : L10n.of(context)!.createGroup, - textFields: [ - DialogTextField( - hintText: roomType == AddRoomType.subspace - ? L10n.of(context)!.spaceName - : L10n.of(context)!.groupName, - minLines: 1, - maxLines: 1, - maxLength: 64, - validator: (text) { - if (text == null || text.isEmpty) { - return L10n.of(context)!.pleaseChoose; - } - return null; - }, - ), - DialogTextField( - hintText: L10n.of(context)!.chatDescription, - minLines: 4, - maxLines: 8, - maxLength: 255, - ), - ], - okLabel: L10n.of(context)!.create, - cancelLabel: L10n.of(context)!.cancel, - ); - if (names == null) return; - final client = Matrix.of(context).client; - final result = await showFutureLoadingDialog( - context: context, - future: () async { - late final String roomId; - final activeSpace = client.getRoomById(activeSpaceId!)!; - await activeSpace.postLoad(); - - if (roomType == AddRoomType.subspace) { - roomId = await client.createSpace( - name: names.first, - topic: names.last.isEmpty ? null : names.last, - visibility: activeSpace.joinRules == JoinRules.public - ? sdk.Visibility.public - : sdk.Visibility.private, - ); - } else { - roomId = await client.createGroupChat( - groupName: names.first, - preset: activeSpace.joinRules == JoinRules.public - ? CreateRoomPreset.publicChat - : CreateRoomPreset.privateChat, - visibility: activeSpace.joinRules == JoinRules.public - ? sdk.Visibility.public - : sdk.Visibility.private, - initialState: names.length > 1 && names.last.isNotEmpty - ? [ - sdk.StateEvent( - type: sdk.EventTypes.RoomTopic, - content: {'topic': names.last}, - ), - ] - : null, - ); - } - await activeSpace.setSpaceChild(roomId); - }, - ); - if (result.error != null) return; - } - void onChatTap(Room room) async { if (room.membership == Membership.invite) { final inviterId = @@ -1004,8 +915,6 @@ enum InviteActions { block, } -enum AddRoomType { chat, subspace } - enum ChatContextAction { open, goToSpace, diff --git a/lib/pages/chat_list/chat_list_view.dart b/lib/pages/chat_list/chat_list_view.dart index 510c6c46d..a106e5dd7 100644 --- a/lib/pages/chat_list/chat_list_view.dart +++ b/lib/pages/chat_list/chat_list_view.dart @@ -146,9 +146,11 @@ class ChatListView extends StatelessWidget { onKeysPressed: () => context.go('/rooms/newprivatechat'), helpLabel: L10n.of(context)!.newChat, child: selectMode == SelectMode.normal && - !controller.isSearchMode + !controller.isSearchMode && + controller.activeSpaceId == null ? FloatingActionButton.extended( - onPressed: controller.addChatAction, + onPressed: () => + context.go('/rooms/newprivatechat'), icon: const Icon(Icons.add_outlined), label: Text( L10n.of(context)!.chat, diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index 3401aa1f1..5ad99faa8 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -5,6 +5,7 @@ import 'package:collection/collection.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:go_router/go_router.dart'; +import 'package:matrix/matrix.dart' as sdk; import 'package:matrix/matrix.dart'; import 'package:fluffychat/config/app_config.dart'; @@ -15,6 +16,8 @@ import 'package:fluffychat/utils/stream_extension.dart'; import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/matrix.dart'; +enum AddRoomType { chat, subspace } + class SpaceView extends StatefulWidget { final String spaceId; final void Function() onBack; @@ -160,6 +163,95 @@ class _SpaceViewState extends State { } } + void _addChatOrSubspace() async { + final roomType = await showConfirmationDialog( + context: context, + title: L10n.of(context)!.addChatOrSubSpace, + actions: [ + AlertDialogAction( + key: AddRoomType.subspace, + label: L10n.of(context)!.createNewSpace, + ), + AlertDialogAction( + key: AddRoomType.chat, + label: L10n.of(context)!.createGroup, + ), + ], + ); + if (roomType == null) return; + + final names = await showTextInputDialog( + context: context, + title: roomType == AddRoomType.subspace + ? L10n.of(context)!.createNewSpace + : L10n.of(context)!.createGroup, + textFields: [ + DialogTextField( + hintText: roomType == AddRoomType.subspace + ? L10n.of(context)!.spaceName + : L10n.of(context)!.groupName, + minLines: 1, + maxLines: 1, + maxLength: 64, + validator: (text) { + if (text == null || text.isEmpty) { + return L10n.of(context)!.pleaseChoose; + } + return null; + }, + ), + DialogTextField( + hintText: L10n.of(context)!.chatDescription, + minLines: 4, + maxLines: 8, + maxLength: 255, + ), + ], + okLabel: L10n.of(context)!.create, + cancelLabel: L10n.of(context)!.cancel, + ); + if (names == null) return; + final client = Matrix.of(context).client; + final result = await showFutureLoadingDialog( + context: context, + future: () async { + late final String roomId; + final activeSpace = client.getRoomById(widget.spaceId)!; + await activeSpace.postLoad(); + + if (roomType == AddRoomType.subspace) { + roomId = await client.createSpace( + name: names.first, + topic: names.last.isEmpty ? null : names.last, + visibility: activeSpace.joinRules == JoinRules.public + ? sdk.Visibility.public + : sdk.Visibility.private, + ); + } else { + roomId = await client.createGroupChat( + groupName: names.first, + preset: activeSpace.joinRules == JoinRules.public + ? CreateRoomPreset.publicChat + : CreateRoomPreset.privateChat, + visibility: activeSpace.joinRules == JoinRules.public + ? sdk.Visibility.public + : sdk.Visibility.private, + initialState: names.length > 1 && names.last.isNotEmpty + ? [ + StateEvent( + type: EventTypes.RoomTopic, + content: {'topic': names.last}, + ), + ] + : null, + ); + } + await activeSpace.setSpaceChild(roomId); + }, + ); + if (result.error != null) return; + } + @override Widget build(BuildContext context) { final room = Matrix.of(context).client.getRoomById(widget.spaceId); @@ -352,22 +444,55 @@ class _SpaceViewState extends State { itemCount: joinedRooms.length + 1, itemBuilder: (context, i) { if (i == 0) { - return SearchTitle( - title: L10n.of(context)!.joinedChats, - icon: const Icon(Icons.chat_outlined), + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (room.canChangeStateEvent( + EventTypes.SpaceChild, + ) && + filter.isEmpty) ...[ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 1, + ), + child: Material( + borderRadius: BorderRadius.circular( + AppConfig.borderRadius, + ), + clipBehavior: Clip.hardEdge, + child: ListTile( + onTap: _addChatOrSubspace, + leading: const CircleAvatar( + radius: Avatar.defaultSize / 2, + child: Icon(Icons.add_outlined), + ), + title: Text( + L10n.of(context)!.addChatOrSubSpace, + style: const TextStyle(fontSize: 14), + ), + ), + ), + ), + ], + SearchTitle( + title: L10n.of(context)!.joinedChats, + icon: const Icon(Icons.chat_outlined), + ), + ], ); } i--; - final room = joinedRooms[i]; + final joinedRoom = joinedRooms[i]; return ChatListItem( - room, + joinedRoom, filter: filter, - onTap: () => widget.onChatTab(room), + onTap: () => widget.onChatTab(joinedRoom), onLongPress: (context) => widget.onChatContext( - room, + joinedRoom, context, ), - activeChat: widget.activeChat == room.id, + activeChat: widget.activeChat == joinedRoom.id, ); }, ), From 9e737276b629fc16455ad4807508d29f36b26a89 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 22 Jul 2024 20:06:55 +0200 Subject: [PATCH 7/7] chore: Follow up active filter --- lib/pages/chat_list/chat_list.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index befba299a..63cb35571 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -100,7 +100,9 @@ class ChatListController extends State context.push('/rooms/newspace'); } - ActiveFilter activeFilter = ActiveFilter.allChats; + ActiveFilter activeFilter = AppConfig.separateChatTypes + ? ActiveFilter.messages + : ActiveFilter.allChats; String? _activeSpaceId; String? get activeSpaceId => _activeSpaceId;