mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Display members roles
This commit is contained in:
parent
e2bf5e73dd
commit
f179e7e1d5
@ -2,7 +2,9 @@ import 'package:comunic/helpers/groups_helper.dart';
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/lists/group_members_list.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/models/group.dart';
|
||||
import 'package:comunic/models/group_membership.dart';
|
||||
import 'package:comunic/ui/dialogs/multi_choices_dialog.dart';
|
||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||
@ -51,6 +53,7 @@ class _GroupMembersScreenState extends State<GroupMembersScreen> {
|
||||
onReload: _refresh,
|
||||
onBuild: _buildBodyContent,
|
||||
errorMessage: tr("Could not load the list of members of this group!"),
|
||||
showOldDataWhileUpdating: true,
|
||||
);
|
||||
|
||||
Widget _buildBodyContent() {
|
||||
@ -59,6 +62,29 @@ class _GroupMembersScreenState extends State<GroupMembersScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
List<MultiChoiceEntry<GroupMembershipLevel>> get _membershipLevels => [
|
||||
MultiChoiceEntry(
|
||||
id: GroupMembershipLevel.ADMINISTRATOR,
|
||||
title: tr("Administrator"),
|
||||
subtitle:
|
||||
tr("Can change members privileges and change group settings")),
|
||||
MultiChoiceEntry(
|
||||
id: GroupMembershipLevel.MODERATOR,
|
||||
title: tr("Moderator"),
|
||||
subtitle: tr(
|
||||
"Can always create posts, invite users and respond to membership request")),
|
||||
MultiChoiceEntry(
|
||||
id: GroupMembershipLevel.MEMBER,
|
||||
title: tr("Member"),
|
||||
subtitle: tr("Can access to all group posts")),
|
||||
MultiChoiceEntry(
|
||||
id: GroupMembershipLevel.PENDING, title: tr("Requested")),
|
||||
MultiChoiceEntry(
|
||||
id: GroupMembershipLevel.INVITED, title: tr("Invited")),
|
||||
MultiChoiceEntry(
|
||||
id: GroupMembershipLevel.VISITOR, title: tr("Visitor")),
|
||||
];
|
||||
|
||||
ListTile _buildGroupMemberTile(GroupMembership membership) {
|
||||
final user = _users.getUser(membership.userID);
|
||||
|
||||
@ -67,6 +93,8 @@ class _GroupMembersScreenState extends State<GroupMembersScreen> {
|
||||
user: user,
|
||||
),
|
||||
title: Text(user.displayName),
|
||||
subtitle: Text(
|
||||
_membershipLevels.firstWhere((f) => f.id == membership.level).title),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user