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:
@@ -55,12 +55,15 @@ class GetParticipantsResponseObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum GetParticipantsResponseObjectParticipantType {
|
enum GetParticipantsResponseObjectParticipantType {
|
||||||
@JsonValue(1) owner,
|
@JsonValue(1) owner('Besitzer'),
|
||||||
@JsonValue(2) moderator,
|
@JsonValue(2) moderator('Moderator'),
|
||||||
@JsonValue(3) user,
|
@JsonValue(3) user('Teilnehmer'),
|
||||||
@JsonValue(4) guest,
|
@JsonValue(4) guest('Gast'),
|
||||||
@JsonValue(5) userFollowingPublicLink,
|
@JsonValue(5) userFollowingPublicLink('Teilnehmer über Link'),
|
||||||
@JsonValue(6) guestWithModeratorPermissions
|
@JsonValue(6) guestWithModeratorPermissions('Gast Moderator');
|
||||||
|
|
||||||
|
const GetParticipantsResponseObjectParticipantType(this.prettyName);
|
||||||
|
final String prettyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GetParticipantsResponseObjectParticipantsInCallFlags {
|
enum GetParticipantsResponseObjectParticipantsInCallFlags {
|
||||||
|
@@ -66,7 +66,7 @@ class _ChatInfoState extends State<ChatInfo> {
|
|||||||
if(participants != null) ...[
|
if(participants != null) ...[
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.supervised_user_circle),
|
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),
|
trailing: const Icon(Icons.arrow_right),
|
||||||
onTap: () => TalkNavigator.pushSplitView(context, ParticipantsListView(participants!)),
|
onTap: () => TalkNavigator.pushSplitView(context, ParticipantsListView(participants!)),
|
||||||
),
|
),
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../../../api/marianumcloud/talk/getParticipants/getParticipantsResponse.dart';
|
import '../../../../../api/marianumcloud/talk/getParticipants/getParticipantsResponse.dart';
|
||||||
@@ -9,22 +10,35 @@ class ParticipantsListView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final participants = participantsResponse.data.map((participant) => ListTile(
|
lastname(participant) => participant.displayName.toString().split(' ').last;
|
||||||
leading: UserAvatar(id: participant.actorId),
|
|
||||||
title: Text(participant.displayName),
|
final participants = participantsResponse.data
|
||||||
subtitle: participant.statusMessage != null ? Text(participant.statusMessage!) : null,
|
.sorted((a, b) => lastname(a).compareTo(lastname(b)))
|
||||||
)).toList();
|
.sorted((a, b) => a.participantType.index.compareTo(b.participantType.index));
|
||||||
|
var groupedParticipants = participants.groupListsBy((participant) => participant.participantType);
|
||||||
lastname(participant) => participant.title.toString().split(' ').last;
|
|
||||||
participants.sort((a, b) => lastname(a).compareTo(lastname(b)));
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Teilnehmende'),
|
title: const Text('Mitglieder'),
|
||||||
),
|
),
|
||||||
body: ListView(
|
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(),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -101,6 +101,7 @@ dependencies:
|
|||||||
url_launcher: ^6.3.1
|
url_launcher: ^6.3.1
|
||||||
uuid: ^4.5.1
|
uuid: ^4.5.1
|
||||||
open_filex: ^4.7.0
|
open_filex: ^4.7.0
|
||||||
|
collection: ^1.19.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user