subspace sorting

Fixes #183
This commit is contained in:
Henry Hiles 2026-11-25 16:29:09 -05:00
commit 432064e111
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -94,41 +94,48 @@ class const RoomsPane({super.key}) extends ConsumerWidget {
),
],
),
if (selectedSpace.children.isNotEmpty)
.new(
header: selectedSpace.room == null
? null
: const DividerWidget(Text("Rooms")),
destinations: selectedSpace.children.toDestinations(
isDm: isDm,
),
),
...selectedSpace.subSpaces.map(
(subSpace) => NavigationRailM3ESection(
header: DividerWidget(
Row(
mainAxisSize: .min,
spacing: 8,
children: [
if (subSpace.room.metadata?.avatar != null)
AvatarOrHash(
subSpace.room.metadata?.avatar,
subSpace.room.metadata?.name ?? "Unnamed Room",
dimension: 16,
),
Flexible(
child: Text(
subSpace.room.metadata?.name ?? "Unnamed Space",
maxLines: 1,
overflow: .ellipsis,
),
...selectedSpace.subSpaces
.map(
(subSpace) => NavigationRailM3ESection(
header: DividerWidget(
Row(
mainAxisSize: .min,
spacing: 8,
children: [
if (subSpace.room.metadata?.avatar != null)
AvatarOrHash(
subSpace.room.metadata?.avatar,
subSpace.room.metadata?.name ?? "Unnamed Room",
dimension: 16,
),
Flexible(
child: Text(
subSpace.room.metadata?.name ?? "Unnamed Space",
maxLines: 1,
overflow: .ellipsis,
),
),
],
),
],
),
destinations: subSpace.children.toDestinations(
isDm: isDm,
),
),
),
destinations: subSpace.children.toDestinations(isDm: isDm),
),
),
)
.toIList()
// Sorted among the subspaces, matching allChildRooms
.insertAll(selectedSpace.childrenIndex, [
if (selectedSpace.children.isNotEmpty)
NavigationRailM3ESection(
header: selectedSpace.room == null
? null
: const DividerWidget(Text("Rooms")),
destinations: selectedSpace.children.toDestinations(
isDm: isDm,
),
),
]),
],
onDestinationSelected: (value) {
ref