sorted participants list alphabetically #87
@ -13,16 +13,23 @@ class ParticipantsListView extends StatefulWidget {
|
|||||||
|
|
||||||
class _ParticipantsListViewState extends State<ParticipantsListView> {
|
class _ParticipantsListViewState extends State<ParticipantsListView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) {
|
||||||
|
final participants = widget.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)));
|
||||||
|
|||||||
|
|
||||||
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Teilnehmende'),
|
title: const Text('Teilnehmende'),
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: widget.participantsResponse.data.map((participant) => ListTile(
|
children: participants,
|
||||||
leading: UserAvatar(id: participant.actorId),
|
|
||||||
title: Text(participant.displayName),
|
|
||||||
subtitle: participant.statusMessage != null ? Text(participant.statusMessage!) : null,
|
|
||||||
)).toList(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user
ggf. kann das sort aus der Build methode rausgezogen werden und das Widget zu einem Stateless werden