mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-20 02:59:26 +01:00
chore: Sort subspaces on top
This commit is contained in:
parent
fa629f8fb7
commit
0b90e1ff88
@ -186,8 +186,10 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
final parentSpace = allSpaces.firstWhereOrNull((space) => space
|
final parentSpace = allSpaces.firstWhereOrNull((space) => space
|
||||||
.spaceChildren
|
.spaceChildren
|
||||||
.any((child) => child.roomId == activeSpaceId));
|
.any((child) => child.roomId == activeSpaceId));
|
||||||
|
final spaceChildren = response.rooms
|
||||||
|
..sort((a, b) => a.roomType == 'm.space' ? -1 : 1);
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: response.rooms.length + 1,
|
itemCount: spaceChildren.length + 1,
|
||||||
controller: widget.scrollController,
|
controller: widget.scrollController,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@ -211,7 +213,7 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
final spaceChild = response.rooms[i];
|
final spaceChild = spaceChildren[i];
|
||||||
final room = client.getRoomById(spaceChild.roomId);
|
final room = client.getRoomById(spaceChild.roomId);
|
||||||
if (room != null && !room.isSpace) {
|
if (room != null && !room.isSpace) {
|
||||||
return ChatListItem(
|
return ChatListItem(
|
||||||
|
Loading…
Reference in New Issue
Block a user