mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-24 14:32:37 +01:00
fix: space bottom bar with group/DM separation
- allow group/DM separation for space bottom bar/drawer - fix unscrollable overflow of room list Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
bfbf425663
commit
beb3ae9be3
@ -80,9 +80,11 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
|
||||
.shouldShowStoriesHeader(context);
|
||||
child = ListView.builder(
|
||||
key: ValueKey(Matrix.of(context).client.userID.toString() +
|
||||
widget.controller.activeSpaceId.toString()),
|
||||
widget.controller.activeSpaceId.toString() +
|
||||
widget.controller.activeSpacesEntry.runtimeType.toString()),
|
||||
controller: widget.controller.scrollController,
|
||||
itemCount: rooms.length + (displayStoriesHeader ? 1 : 0),
|
||||
// add +1 space below in order to properly scroll below the spaces bar
|
||||
itemCount: rooms.length + (displayStoriesHeader ? 2 : 1),
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
if (displayStoriesHeader) {
|
||||
if (i == 0) {
|
||||
@ -90,6 +92,9 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
|
||||
}
|
||||
i--;
|
||||
}
|
||||
if (i >= rooms.length) {
|
||||
return const ListTile();
|
||||
}
|
||||
return ChatListItem(
|
||||
rooms[i],
|
||||
selected: widget.controller.selectedRoomIds.contains(rooms[i].id),
|
||||
|
@ -94,11 +94,10 @@ class _SpacesBottomNavigation extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final currentIndex = controller.activeSpaceId == null
|
||||
? 1
|
||||
: controller.spaces
|
||||
.indexWhere((space) => controller.activeSpaceId == space.id) +
|
||||
2;
|
||||
final currentIndex = controller.spacesEntries.indexWhere((space) =>
|
||||
controller.activeSpacesEntry.runtimeType == space.runtimeType &&
|
||||
(controller.activeSpaceId == space.getSpace(context)?.id)) +
|
||||
1;
|
||||
|
||||
return Container(
|
||||
height: 56,
|
||||
@ -110,15 +109,10 @@ class _SpacesBottomNavigation extends StatelessWidget {
|
||||
currentIndex: currentIndex,
|
||||
onTap: (i) => i == 0
|
||||
? controller.expandSpaces()
|
||||
: i == 1
|
||||
? controller.setActiveSpacesEntry(
|
||||
context,
|
||||
null,
|
||||
)
|
||||
: controller.setActiveSpacesEntry(
|
||||
context,
|
||||
controller.spacesEntries[i],
|
||||
),
|
||||
: controller.setActiveSpacesEntry(
|
||||
context,
|
||||
controller.spacesEntries[i - 1],
|
||||
),
|
||||
selectedItemColor: Theme.of(context).colorScheme.primary,
|
||||
items: [
|
||||
SalomonBottomBarItem(
|
||||
|
@ -13,11 +13,9 @@ class SpacesDrawer extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final currentIndex = controller.activeSpaceId == null
|
||||
? 0
|
||||
: controller.spaces
|
||||
.indexWhere((space) => controller.activeSpaceId == space.id) +
|
||||
1;
|
||||
final currentIndex = controller.spacesEntries.indexWhere((space) =>
|
||||
controller.activeSpacesEntry.runtimeType == space.runtimeType &&
|
||||
(controller.activeSpaceId == space.getSpace(context)?.id));
|
||||
|
||||
final Map<SpacesEntry, dynamic> spaceHierarchy =
|
||||
Map.fromEntries(controller.spacesEntries.map((e) => MapEntry(e, null)));
|
||||
@ -30,54 +28,46 @@ class SpacesDrawer extends StatelessWidget {
|
||||
return false;
|
||||
},
|
||||
child: Column(
|
||||
children: List.generate(
|
||||
spaceHierarchy.length,
|
||||
(index) {
|
||||
if (index == 0) {
|
||||
return ListTile(
|
||||
selected: currentIndex == index,
|
||||
leading: const Icon(Icons.keyboard_arrow_down),
|
||||
title: Text(L10n.of(context)!.allChats),
|
||||
onTap: () => controller.setActiveSpacesEntry(
|
||||
context,
|
||||
null,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final space = spaceHierarchy.keys.toList()[index];
|
||||
final room = space.getSpace(context)!;
|
||||
return ListTile(
|
||||
selected: currentIndex == index,
|
||||
leading: Avatar(
|
||||
mxContent: room.avatar,
|
||||
name: space.getName(context),
|
||||
size: 24,
|
||||
fontSize: 12,
|
||||
),
|
||||
title: Text(space.getName(context)),
|
||||
subtitle: room.topic.isEmpty
|
||||
? null
|
||||
: Tooltip(
|
||||
message: room.topic,
|
||||
child: Text(
|
||||
room.topic.replaceAll('\n', ' '),
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
children: List.generate(spaceHierarchy.length, (index) {
|
||||
final space = spaceHierarchy.keys.toList()[index];
|
||||
final room = space.getSpace(context);
|
||||
final active = currentIndex == index;
|
||||
return ListTile(
|
||||
selected: active,
|
||||
leading: index == 0
|
||||
? const Icon(Icons.keyboard_arrow_down)
|
||||
: room == null
|
||||
? space.getIcon(active)
|
||||
: Avatar(
|
||||
mxContent: room.avatar,
|
||||
name: space.getName(context),
|
||||
size: 24,
|
||||
fontSize: 12,
|
||||
),
|
||||
onTap: () => controller.setActiveSpacesEntry(
|
||||
context,
|
||||
space,
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
tooltip: L10n.of(context)!.edit,
|
||||
onPressed: () => controller.editSpace(context, room.id),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
title: Text(space.getName(context)),
|
||||
subtitle: room?.topic.isEmpty ?? true
|
||||
? null
|
||||
: Tooltip(
|
||||
message: room!.topic,
|
||||
child: Text(
|
||||
room.topic.replaceAll('\n', ' '),
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
onTap: () => controller.setActiveSpacesEntry(
|
||||
context,
|
||||
space,
|
||||
),
|
||||
trailing: room != null
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
tooltip: L10n.of(context)!.edit,
|
||||
onPressed: () => controller.editSpace(context, room.id),
|
||||
)
|
||||
: null,
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <connectivity_plus_windows/connectivity_plus_windows_plugin.h>
|
||||
#include <desktop_drop/desktop_drop_plugin.h>
|
||||
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
|
||||
#include <file_selector_windows/file_selector_plugin.h>
|
||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
@ -22,8 +21,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
|
||||
DesktopLifecyclePluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("DesktopLifecyclePlugin"));
|
||||
FileSelectorPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FileSelectorPlugin"));
|
||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||
FlutterWebRTCPluginRegisterWithRegistrar(
|
||||
|
@ -6,7 +6,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
connectivity_plus_windows
|
||||
desktop_drop
|
||||
desktop_lifecycle
|
||||
file_selector_windows
|
||||
flutter_secure_storage_windows
|
||||
flutter_webrtc
|
||||
permission_handler_windows
|
||||
|
Loading…
Reference in New Issue
Block a user