Merge pull request 'develop-groupedParticipants' (#89) from develop-groupedParticipants into develop

Reviewed-on: #89
Reviewed-by: Elias Müller <elias@elias-mueller.com>
This commit is contained in:
2025-09-06 14:12:10 +00:00
4 changed files with 36 additions and 18 deletions

View File

@@ -55,12 +55,15 @@ class GetParticipantsResponseObject {
}
enum GetParticipantsResponseObjectParticipantType {
@JsonValue(1) owner,
@JsonValue(2) moderator,
@JsonValue(3) user,
@JsonValue(4) guest,
@JsonValue(5) userFollowingPublicLink,
@JsonValue(6) guestWithModeratorPermissions
@JsonValue(1) owner('Besitzer'),
@JsonValue(2) moderator('Moderator'),
@JsonValue(3) user('Teilnehmer'),
@JsonValue(4) guest('Gast'),
@JsonValue(5) userFollowingPublicLink('Teilnehmer über Link'),
@JsonValue(6) guestWithModeratorPermissions('Gast Moderator');
const GetParticipantsResponseObjectParticipantType(this.prettyName);
final String prettyName;
}
enum GetParticipantsResponseObjectParticipantsInCallFlags {

View File

@@ -66,7 +66,7 @@ class _ChatInfoState extends State<ChatInfo> {
if(participants != null) ...[
ListTile(
leading: const Icon(Icons.supervised_user_circle),
title: Text('${participants!.data.length} Teilnehmer'),
title: Text('${participants!.data.length} Mitglieder'),
trailing: const Icon(Icons.arrow_right),
onTap: () => TalkNavigator.pushSplitView(context, ParticipantsListView(participants!)),
),

View File

@@ -1,3 +1,4 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import '../../../../../api/marianumcloud/talk/getParticipants/getParticipantsResponse.dart';
@@ -9,22 +10,35 @@ class ParticipantsListView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final participants = participantsResponse.data.map((participant) => ListTile(
leading: UserAvatar(id: participant.actorId),
title: Text(participant.displayName),
subtitle: participant.statusMessage != null ? Text(participant.statusMessage!) : null,
)).toList();
lastname(participant) => participant.title.toString().split(' ').last;
participants.sort((a, b) => lastname(a).compareTo(lastname(b)));
lastname(participant) => participant.displayName.toString().split(' ').last;
final participants = participantsResponse.data
.sorted((a, b) => lastname(a).compareTo(lastname(b)))
.sorted((a, b) => a.participantType.index.compareTo(b.participantType.index));
var groupedParticipants = participants.groupListsBy((participant) => participant.participantType);
return Scaffold(
appBar: AppBar(
title: const Text('Teilnehmende'),
title: const Text('Mitglieder'),
),
body: ListView(
children: participants,
),
children: [
...groupedParticipants.entries.map((entry) => Column(
children: [
ListTile(
title: Text(entry.key.prettyName),
titleTextStyle: TextStyle(fontWeight: FontWeight.bold),
),
...entry.value.map((participant) => ListTile(
leading: UserAvatar(id: participant.actorId),
title: Text(participant.displayName),
subtitle: participant.statusMessage != null ? Text(participant.statusMessage!) : null,
)),
Divider(),
],
))
],
)
);
}
}

View File

@@ -101,6 +101,7 @@ dependencies:
url_launcher: ^6.3.1
uuid: ^4.5.1
open_filex: ^4.7.0
collection: ^1.19.0
dev_dependencies:
flutter_test: